@thatopen/components 2.1.1 → 2.1.2
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/Components/index.d.ts +1 -1
- package/dist/fragments/Classifier/index.d.ts +12 -5
- package/dist/ifc/IfcRelationsIndexer/index.d.ts +10 -0
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +78 -43
- package/dist/namespace.d.ts +1796 -1779
- package/package.json +1 -1
package/dist/namespace.d.ts
CHANGED
|
@@ -1,568 +1,592 @@
|
|
|
1
1
|
declare namespace OBC {
|
|
2
|
+
export declare function isPointInFrontOfPlane(point: number[], planePoint: number[], planeNormal: number[]): boolean;
|
|
2
3
|
import * as THREE from "three";
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
export declare class MaterialsUtils {
|
|
5
|
+
static isTransparent(material: THREE.Material): boolean;
|
|
6
|
+
}
|
|
7
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
8
|
+
import { Components, Component } from "../../core";
|
|
5
9
|
/**
|
|
6
|
-
* A
|
|
10
|
+
* A component that hides or isolates fragments within a 3D scene. It extends the base Component class and provides methods to control fragment visibility and isolation. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Hider). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Hider).
|
|
7
11
|
*/
|
|
8
|
-
export declare class
|
|
9
|
-
private _disposedComponents;
|
|
10
|
-
/** {@link Component.enabled} */
|
|
11
|
-
enabled: boolean;
|
|
12
|
+
export declare class Hider extends Component {
|
|
12
13
|
/**
|
|
13
14
|
* A unique identifier for the component.
|
|
14
15
|
* This UUID is used to register the component within the Components system.
|
|
15
16
|
*/
|
|
16
|
-
static readonly uuid: "
|
|
17
|
+
static readonly uuid: "dd9ccf2d-8a21-4821-b7f6-2949add16a29";
|
|
18
|
+
/** {@link Component.enabled} */
|
|
19
|
+
enabled: boolean;
|
|
17
20
|
constructor(components: Components);
|
|
18
21
|
/**
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
24
|
-
* using any of these in other parts of the application, make sure that you
|
|
25
|
-
* remove them from the mesh before disposing it.
|
|
26
|
-
*
|
|
27
|
-
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
28
|
-
* to remove.
|
|
22
|
+
* Sets the visibility of fragments within the 3D scene.
|
|
23
|
+
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
24
|
+
* If 'items' is provided, only the specified fragments will be affected.
|
|
29
25
|
*
|
|
30
|
-
* @param
|
|
26
|
+
* @param visible - The visibility state to set for the fragments.
|
|
27
|
+
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
28
|
+
* If not provided, all fragments will be affected.
|
|
31
29
|
*
|
|
32
|
-
* @
|
|
30
|
+
* @returns {void}
|
|
33
31
|
*/
|
|
34
|
-
|
|
32
|
+
set(visible: boolean, items?: FRAGS.FragmentIdMap): void;
|
|
35
33
|
/**
|
|
36
|
-
*
|
|
34
|
+
* Isolates fragments within the 3D scene by hiding all other fragments and showing only the specified ones.
|
|
35
|
+
* It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
|
|
37
36
|
*
|
|
38
|
-
* @param
|
|
39
|
-
*
|
|
40
|
-
*
|
|
37
|
+
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
38
|
+
* If not provided, all fragments will be isolated.
|
|
39
|
+
*
|
|
40
|
+
* @returns {void}
|
|
41
41
|
*/
|
|
42
|
-
|
|
43
|
-
private
|
|
44
|
-
private disposeChildren;
|
|
45
|
-
private static disposeMaterial;
|
|
42
|
+
isolate(items: FRAGS.FragmentIdMap): void;
|
|
43
|
+
private updateCulledVisibility;
|
|
46
44
|
}
|
|
47
|
-
import { Component, Disposable, Event } from "
|
|
45
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
48
46
|
/**
|
|
49
|
-
* The
|
|
47
|
+
* The Exploder component is responsible for managing the explosion of 3D model fragments (generally by floor). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Exploder). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Exploder).
|
|
50
48
|
*/
|
|
51
|
-
export declare class
|
|
49
|
+
export declare class Exploder extends Component implements Disposable {
|
|
52
50
|
/**
|
|
53
|
-
*
|
|
51
|
+
* A unique identifier for the component.
|
|
52
|
+
* This UUID is used to register the component within the Components system.
|
|
54
53
|
*/
|
|
55
|
-
static readonly
|
|
54
|
+
static readonly uuid: "d260618b-ce88-4c7d-826c-6debb91de3e2";
|
|
56
55
|
/** {@link Disposable.onDisposed} */
|
|
57
|
-
readonly onDisposed: Event<
|
|
58
|
-
/**
|
|
59
|
-
* The list of components created in this app.
|
|
60
|
-
* The keys are UUIDs and the values are instances of the components.
|
|
61
|
-
*/
|
|
62
|
-
readonly list: Map<string, Component>;
|
|
63
|
-
/**
|
|
64
|
-
* If disabled, the animation loop will be stopped.
|
|
65
|
-
* Default value is false.
|
|
66
|
-
*/
|
|
56
|
+
readonly onDisposed: Event<unknown>;
|
|
57
|
+
/** {@link Component.enabled} */
|
|
67
58
|
enabled: boolean;
|
|
68
|
-
private _clock;
|
|
69
59
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* @param uuid - The unique identifier of the component.
|
|
74
|
-
* @param instance - The instance of the component to be added.
|
|
75
|
-
*
|
|
76
|
-
* @throws Will throw an error if a component with the same UUID already exists.
|
|
77
|
-
*
|
|
78
|
-
* @internal
|
|
60
|
+
* The height of the explosion animation.
|
|
61
|
+
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
62
|
+
* Default value is 10.
|
|
79
63
|
*/
|
|
80
|
-
|
|
64
|
+
height: number;
|
|
81
65
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @template U - The type of the component to retrieve.
|
|
86
|
-
* @param Component - The constructor function of the component to retrieve.
|
|
87
|
-
*
|
|
88
|
-
* @returns The instance of the requested component.
|
|
89
|
-
*
|
|
90
|
-
* @throws Will throw an error if a component with the same UUID already exists.
|
|
91
|
-
*
|
|
92
|
-
* @internal
|
|
66
|
+
* The group name used for the explosion animation.
|
|
67
|
+
* This property specifies the group of fragments that will be affected by the explosion.
|
|
68
|
+
* Default value is "storeys".
|
|
93
69
|
*/
|
|
94
|
-
|
|
95
|
-
constructor();
|
|
70
|
+
groupName: string;
|
|
96
71
|
/**
|
|
97
|
-
*
|
|
98
|
-
* This
|
|
99
|
-
* and calls the update method.
|
|
100
|
-
*
|
|
101
|
-
* @returns {void}
|
|
72
|
+
* A set of strings representing the exploded items.
|
|
73
|
+
* This set is used to keep track of which items have been exploded.
|
|
102
74
|
*/
|
|
103
|
-
|
|
75
|
+
list: Set<string>;
|
|
76
|
+
constructor(components: Components);
|
|
77
|
+
/** {@link Disposable.dispose} */
|
|
78
|
+
dispose(): void;
|
|
104
79
|
/**
|
|
105
|
-
*
|
|
106
|
-
* the library. A memory leak will be created if:
|
|
80
|
+
* Sets the explosion state of the fragments.
|
|
107
81
|
*
|
|
108
|
-
*
|
|
109
|
-
* called. This is especially relevant in Single Page Applications (React,
|
|
110
|
-
* Angular, Vue, etc).
|
|
82
|
+
* @param active - A boolean indicating whether to activate or deactivate the explosion.
|
|
111
83
|
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* This method applies a vertical transformation to the fragments based on the 'active' parameter.
|
|
86
|
+
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
87
|
+
* If 'active' is false, the fragments are moved back to their original position.
|
|
114
88
|
*
|
|
115
|
-
*
|
|
116
|
-
* [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
89
|
+
* The method also keeps track of the exploded items using the 'list' set.
|
|
117
90
|
*
|
|
91
|
+
* @throws Will throw an error if the 'Classifier' or 'FragmentsManager' components are not found in the 'components' system.
|
|
118
92
|
*/
|
|
119
|
-
|
|
120
|
-
private update;
|
|
121
|
-
private static setupBVH;
|
|
93
|
+
set(active: boolean): void;
|
|
122
94
|
}
|
|
123
|
-
import {
|
|
124
|
-
import
|
|
125
|
-
import
|
|
95
|
+
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
96
|
+
import * as THREE from "three";
|
|
97
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
98
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
99
|
+
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
126
100
|
/**
|
|
127
|
-
*
|
|
101
|
+
* Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
|
|
128
102
|
*/
|
|
129
|
-
export declare class
|
|
103
|
+
export declare class FragmentsManager extends Component implements Disposable {
|
|
130
104
|
/**
|
|
131
105
|
* A unique identifier for the component.
|
|
132
106
|
* This UUID is used to register the component within the Components system.
|
|
133
107
|
*/
|
|
134
|
-
static readonly uuid: "
|
|
135
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
136
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
137
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
138
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
108
|
+
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
139
109
|
/** {@link Disposable.onDisposed} */
|
|
140
110
|
readonly onDisposed: Event<unknown>;
|
|
141
111
|
/**
|
|
142
|
-
*
|
|
143
|
-
* The event passes the newly created world as a parameter.
|
|
112
|
+
* Event triggered when fragments are loaded.
|
|
144
113
|
*/
|
|
145
|
-
readonly
|
|
114
|
+
readonly onFragmentsLoaded: Event<FragmentsGroup>;
|
|
146
115
|
/**
|
|
147
|
-
*
|
|
148
|
-
* The event passes the UUID of the deleted world as a parameter.
|
|
116
|
+
* Event triggered when fragments are disposed.
|
|
149
117
|
*/
|
|
150
|
-
readonly
|
|
118
|
+
readonly onFragmentsDisposed: Event<{
|
|
119
|
+
groupID: string;
|
|
120
|
+
fragmentIDs: string[];
|
|
121
|
+
}>;
|
|
151
122
|
/**
|
|
152
|
-
*
|
|
153
|
-
* The key is the unique identifier
|
|
123
|
+
* Map containing all loaded fragments.
|
|
124
|
+
* The key is the fragment's unique identifier, and the value is the fragment itself.
|
|
154
125
|
*/
|
|
155
|
-
list: Map<string,
|
|
126
|
+
readonly list: Map<string, Fragment>;
|
|
127
|
+
/**
|
|
128
|
+
* Map containing all loaded fragment groups.
|
|
129
|
+
* The key is the group's unique identifier, and the value is the group itself.
|
|
130
|
+
*/
|
|
131
|
+
readonly groups: Map<string, FragmentsGroup>;
|
|
132
|
+
baseCoordinationModel: string;
|
|
156
133
|
/** {@link Component.enabled} */
|
|
157
134
|
enabled: boolean;
|
|
158
|
-
|
|
135
|
+
private _loader;
|
|
159
136
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
* @
|
|
163
|
-
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
164
|
-
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
165
|
-
*
|
|
166
|
-
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
137
|
+
* Getter for the meshes of all fragments in the FragmentsManager.
|
|
138
|
+
* It iterates over the fragments in the list and pushes their meshes into an array.
|
|
139
|
+
* @returns {THREE.Mesh[]} An array of THREE.Mesh objects representing the fragments.
|
|
167
140
|
*/
|
|
168
|
-
|
|
141
|
+
get meshes(): THREE.Mesh<THREE.BufferGeometry<THREE.NormalBufferAttributes>, THREE.Material | THREE.Material[], THREE.Object3DEventMap>[];
|
|
142
|
+
constructor(components: Components);
|
|
143
|
+
/** {@link Disposable.dispose} */
|
|
144
|
+
dispose(): void;
|
|
169
145
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
146
|
+
* Dispose of a specific fragment group.
|
|
147
|
+
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
148
|
+
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
175
149
|
*
|
|
176
|
-
* @
|
|
150
|
+
* @param group - The fragment group to be disposed.
|
|
177
151
|
*/
|
|
178
|
-
|
|
152
|
+
disposeGroup(group: FragmentsGroup): void;
|
|
179
153
|
/**
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* @
|
|
154
|
+
* Loads a binary file that contain fragment geometry.
|
|
155
|
+
* @param data - The binary data to load.
|
|
156
|
+
* @param config - Optional configuration for loading.
|
|
157
|
+
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
158
|
+
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
159
|
+
* @returns The loaded FragmentsGroup.
|
|
185
160
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
import { Components } from "../Components";
|
|
193
|
-
/**
|
|
194
|
-
* A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
|
|
195
|
-
*/
|
|
196
|
-
export declare class Raycasters extends Component implements Disposable {
|
|
161
|
+
load(data: Uint8Array, config?: Partial<{
|
|
162
|
+
coordinate: boolean;
|
|
163
|
+
name: string;
|
|
164
|
+
properties: FRAGS.IfcProperties;
|
|
165
|
+
relationsMap: RelationsMap;
|
|
166
|
+
}>): FragmentsGroup;
|
|
197
167
|
/**
|
|
198
|
-
*
|
|
199
|
-
*
|
|
168
|
+
* Export the specified fragmentsgroup to binary data.
|
|
169
|
+
* @param group - the fragments group to be exported.
|
|
170
|
+
* @returns the exported data as binary buffer.
|
|
200
171
|
*/
|
|
201
|
-
|
|
202
|
-
/** {@link Component.enabled} */
|
|
203
|
-
enabled: boolean;
|
|
172
|
+
export(group: FragmentsGroup): Uint8Array;
|
|
204
173
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
174
|
+
* Gets a map of model IDs to sets of express IDs for the given fragment ID map.
|
|
175
|
+
* @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
|
|
176
|
+
* @returns A map of model IDs to sets of express IDs.
|
|
177
|
+
*/
|
|
178
|
+
getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
|
|
179
|
+
[modelID: string]: Set<number>;
|
|
180
|
+
};
|
|
212
181
|
/**
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
182
|
+
* Converts a map of model IDs to sets of express IDs to a fragment ID map.
|
|
183
|
+
* @param modelIdMap - A map of model IDs to their corresponding express IDs.
|
|
184
|
+
* @returns A fragment ID map.
|
|
185
|
+
* @remarks
|
|
186
|
+
* This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
|
|
187
|
+
* and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
|
|
188
|
+
* The fragment ID maps are then merged into a single map and returned.
|
|
189
|
+
* If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
|
|
219
190
|
*/
|
|
220
|
-
|
|
191
|
+
modelIdToFragmentIdMap(modelIdMap: {
|
|
192
|
+
[modelID: string]: Set<number>;
|
|
193
|
+
}): FRAGS.FragmentIdMap;
|
|
221
194
|
/**
|
|
222
|
-
*
|
|
223
|
-
* If
|
|
195
|
+
* Applies coordinate transformation to the provided models.
|
|
196
|
+
* If no models are provided, all groups are used.
|
|
197
|
+
* The first model in the list becomes the base model for coordinate transformation.
|
|
198
|
+
* All other models are then transformed to match the base model's coordinate system.
|
|
199
|
+
*
|
|
200
|
+
* @param models - The models to apply coordinate transformation to.
|
|
201
|
+
* If not provided, all groups are used.
|
|
224
202
|
*
|
|
225
|
-
* @param world - The world for which to delete the SimpleRaycaster instance.
|
|
226
203
|
* @returns {void}
|
|
227
204
|
*/
|
|
228
|
-
|
|
229
|
-
/** {@link Disposable.dispose} */
|
|
230
|
-
dispose(): void;
|
|
205
|
+
coordinate(models?: FragmentsGroup[]): void;
|
|
231
206
|
}
|
|
232
|
-
import
|
|
233
|
-
import
|
|
234
|
-
import { Component, Event,
|
|
207
|
+
import * as THREE from "three";
|
|
208
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
209
|
+
import { Disposable, Component, Event, Components } from "../../core";
|
|
235
210
|
/**
|
|
236
|
-
*
|
|
211
|
+
* Interface representing a classification system. The classification is organized by system and class name, and each class contains a map of fragment IDs with extra information.
|
|
237
212
|
*/
|
|
238
|
-
export
|
|
213
|
+
export interface Classification {
|
|
214
|
+
/**
|
|
215
|
+
* A system within the classification.
|
|
216
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
217
|
+
*/
|
|
218
|
+
[system: string]: {
|
|
219
|
+
/**
|
|
220
|
+
* A class within the system.
|
|
221
|
+
* The key is the class name, and the value is an object containing a map of fragment IDs with extra information.
|
|
222
|
+
*/
|
|
223
|
+
[className: string]: {
|
|
224
|
+
map: FRAGS.FragmentIdMap;
|
|
225
|
+
name: string;
|
|
226
|
+
id: number | null;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* The Classifier component is responsible for classifying and categorizing fragments based on various criteria. It provides methods to add, remove, find, and filter fragments based on their classification. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Classifier). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Classifier).
|
|
232
|
+
*/
|
|
233
|
+
export declare class Classifier extends Component implements Disposable {
|
|
239
234
|
/**
|
|
240
235
|
* A unique identifier for the component.
|
|
241
236
|
* This UUID is used to register the component within the Components system.
|
|
242
237
|
*/
|
|
243
|
-
static readonly uuid: "
|
|
238
|
+
static readonly uuid: "e25a7f3c-46c4-4a14-9d3d-5115f24ebeb7";
|
|
239
|
+
/** {@link Component.enabled} */
|
|
240
|
+
enabled: boolean;
|
|
244
241
|
/**
|
|
245
|
-
*
|
|
242
|
+
* A map representing the classification systems.
|
|
243
|
+
* The key is the system name, and the value is an object representing the classes within the system.
|
|
246
244
|
*/
|
|
245
|
+
list: Classification;
|
|
246
|
+
/** {@link Disposable.onDisposed} */
|
|
247
247
|
readonly onDisposed: Event<unknown>;
|
|
248
|
-
|
|
248
|
+
constructor(components: Components);
|
|
249
|
+
private onFragmentsDisposed;
|
|
250
|
+
/** {@link Disposable.dispose} */
|
|
251
|
+
dispose(): void;
|
|
249
252
|
/**
|
|
250
|
-
*
|
|
253
|
+
* Removes a fragment from the classification based on its unique identifier (guid).
|
|
254
|
+
* This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
|
|
255
|
+
*
|
|
256
|
+
* @param guid - The unique identifier of the fragment to be removed.
|
|
251
257
|
*/
|
|
252
|
-
|
|
253
|
-
/** {@link Component.enabled} */
|
|
254
|
-
get enabled(): boolean;
|
|
255
|
-
/** {@link Component.enabled} */
|
|
256
|
-
set enabled(value: boolean);
|
|
257
|
-
constructor(components: Components);
|
|
258
|
+
remove(guid: string): void;
|
|
258
259
|
/**
|
|
259
|
-
*
|
|
260
|
-
* If
|
|
260
|
+
* Finds and returns fragments based on the provided filter criteria.
|
|
261
|
+
* If no filter is provided, it returns all fragments.
|
|
261
262
|
*
|
|
262
|
-
* @param
|
|
263
|
-
*
|
|
263
|
+
* @param filter - An optional object containing filter criteria.
|
|
264
|
+
* The keys of the object represent the classification system names,
|
|
265
|
+
* and the values are arrays of class names to match.
|
|
264
266
|
*
|
|
265
|
-
* @returns
|
|
267
|
+
* @returns A map of fragment GUIDs to their respective express IDs,
|
|
268
|
+
* where the express IDs are filtered based on the provided filter criteria.
|
|
269
|
+
*
|
|
270
|
+
* @throws Will throw an error if the fragments map is malformed.
|
|
266
271
|
*/
|
|
267
|
-
|
|
272
|
+
find(filter?: {
|
|
273
|
+
[name: string]: string[];
|
|
274
|
+
}): FRAGS.FragmentIdMap;
|
|
268
275
|
/**
|
|
269
|
-
*
|
|
270
|
-
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
276
|
+
* Classifies fragments based on their modelID.
|
|
271
277
|
*
|
|
272
|
-
* @param
|
|
278
|
+
* @param modelID - The unique identifier of the model to classify fragments by.
|
|
279
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
280
|
+
*
|
|
281
|
+
* @remarks
|
|
282
|
+
* This method iterates through the fragments in the provided group,
|
|
283
|
+
* and classifies them based on their modelID.
|
|
284
|
+
* The classification is stored in the 'list.models' property,
|
|
285
|
+
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
273
286
|
*
|
|
274
|
-
* @returns {void}
|
|
275
287
|
*/
|
|
276
|
-
|
|
277
|
-
/** {@link Disposable.dispose} */
|
|
278
|
-
dispose(): void;
|
|
279
|
-
}
|
|
280
|
-
import { MiniMap } from "./src";
|
|
281
|
-
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
282
|
-
import { Components } from "../Components";
|
|
283
|
-
/**
|
|
284
|
-
* A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
|
|
285
|
-
*/
|
|
286
|
-
export declare class MiniMaps extends Component implements Updateable, Disposable {
|
|
288
|
+
byModel(modelID: string, group: FRAGS.FragmentsGroup): void;
|
|
287
289
|
/**
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
+
* Classifies fragments based on their PredefinedType property.
|
|
291
|
+
*
|
|
292
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
293
|
+
*
|
|
294
|
+
* @remarks
|
|
295
|
+
* This method iterates through the properties of the fragments in the provided group,
|
|
296
|
+
* and classifies them based on their PredefinedType property.
|
|
297
|
+
* The classification is stored in the 'list.predefinedTypes' property,
|
|
298
|
+
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
299
|
+
*
|
|
300
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
290
301
|
*/
|
|
291
|
-
|
|
292
|
-
/** {@link Updateable.onAfterUpdate} */
|
|
293
|
-
readonly onAfterUpdate: Event<unknown>;
|
|
294
|
-
/** {@link Updateable.onBeforeUpdate} */
|
|
295
|
-
readonly onBeforeUpdate: Event<unknown>;
|
|
296
|
-
/** {@link Disposable.onDisposed} */
|
|
297
|
-
readonly onDisposed: Event<unknown>;
|
|
298
|
-
/** {@link Component.enabled} */
|
|
299
|
-
enabled: boolean;
|
|
302
|
+
byPredefinedType(group: FRAGS.FragmentsGroup): Promise<void>;
|
|
300
303
|
/**
|
|
301
|
-
*
|
|
304
|
+
* Classifies fragments based on their entity type.
|
|
305
|
+
*
|
|
306
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
307
|
+
*
|
|
308
|
+
* @remarks
|
|
309
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
310
|
+
* and classifies them based on their entity type.
|
|
311
|
+
* The classification is stored in the 'list.entities' property,
|
|
312
|
+
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
313
|
+
*
|
|
314
|
+
* @throws Will throw an error if the fragment ID is not found.
|
|
302
315
|
*/
|
|
303
|
-
|
|
304
|
-
constructor(components: Components);
|
|
316
|
+
byEntity(group: FRAGS.FragmentsGroup): void;
|
|
305
317
|
/**
|
|
306
|
-
*
|
|
307
|
-
* If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
|
|
318
|
+
* Classifies fragments based on a specific IFC relationship.
|
|
308
319
|
*
|
|
309
|
-
* @param
|
|
310
|
-
* @
|
|
311
|
-
* @
|
|
320
|
+
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
321
|
+
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
322
|
+
* @param systemName - The name of the classification system to store the classification.
|
|
323
|
+
*
|
|
324
|
+
* @remarks
|
|
325
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
326
|
+
* and classifies them based on the specified IFC relationship.
|
|
327
|
+
* The classification is stored in the 'list' property under the specified system name,
|
|
328
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
329
|
+
*
|
|
330
|
+
* @throws Will throw an error if the fragment ID is not found or if the IFC relationship is not valid.
|
|
312
331
|
*/
|
|
313
|
-
|
|
332
|
+
byIfcRel(group: FRAGS.FragmentsGroup, ifcRel: number, systemName: string): Promise<void>;
|
|
314
333
|
/**
|
|
315
|
-
*
|
|
316
|
-
* If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
|
|
334
|
+
* Classifies fragments based on their spatial structure in the IFC model.
|
|
317
335
|
*
|
|
318
|
-
* @param
|
|
319
|
-
* @
|
|
336
|
+
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
337
|
+
* @param config - The configuration for the classifier. It includes "useProperties" (if false, the classification will use the expressIDs instead of the names)
|
|
338
|
+
*
|
|
339
|
+
* @remarks
|
|
340
|
+
* This method iterates through the relations of the fragments in the provided group,
|
|
341
|
+
* and classifies them based on their spatial structure in the IFC model.
|
|
342
|
+
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
343
|
+
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
344
|
+
*
|
|
345
|
+
* @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
|
|
320
346
|
*/
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
|
|
347
|
+
bySpatialStructure(model: FRAGS.FragmentsGroup, config?: {
|
|
348
|
+
useProperties: boolean;
|
|
349
|
+
}): Promise<void>;
|
|
350
|
+
/**
|
|
351
|
+
* Sets the color of the specified fragments.
|
|
352
|
+
*
|
|
353
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
354
|
+
* @param color - The color to set for the fragments.
|
|
355
|
+
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
356
|
+
*
|
|
357
|
+
* @remarks
|
|
358
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
359
|
+
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
360
|
+
*
|
|
361
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
362
|
+
*/
|
|
363
|
+
setColor(items: FRAGS.FragmentIdMap, color: THREE.Color, override?: boolean): void;
|
|
364
|
+
/**
|
|
365
|
+
* Resets the color of the specified fragments to their original color.
|
|
366
|
+
*
|
|
367
|
+
* @param items - A map of fragment IDs to their respective express IDs.
|
|
368
|
+
*
|
|
369
|
+
* @remarks
|
|
370
|
+
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
371
|
+
* and resets their color using the 'resetColor' method of the FragmentsGroup class.
|
|
372
|
+
*
|
|
373
|
+
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
374
|
+
*/
|
|
375
|
+
resetColor(items: FRAGS.FragmentIdMap): void;
|
|
376
|
+
protected saveItem(group: FRAGS.FragmentsGroup, systemName: string, className: string, expressID: number, parentID?: number | null): void;
|
|
326
377
|
}
|
|
327
|
-
import * as
|
|
328
|
-
import
|
|
329
|
-
import {
|
|
330
|
-
import { Components } from "
|
|
378
|
+
import * as WEBIFC from "web-ifc";
|
|
379
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
380
|
+
import { IfcFragmentSettings } from "./src";
|
|
381
|
+
import { Component, Components, Event, Disposable } from "../../core";
|
|
331
382
|
/**
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
* @param components - the instance of {@link Components} used.
|
|
335
|
-
* E.g. {@link SimplePlane}.
|
|
383
|
+
* 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).
|
|
336
384
|
*/
|
|
337
|
-
export declare class
|
|
385
|
+
export declare class IfcLoader extends Component implements Disposable {
|
|
338
386
|
/**
|
|
339
387
|
* A unique identifier for the component.
|
|
340
388
|
* This UUID is used to register the component within the Components system.
|
|
341
389
|
*/
|
|
342
|
-
static readonly uuid: "
|
|
343
|
-
/** Event that fires when the user starts dragging a clipping plane. */
|
|
344
|
-
readonly onBeforeDrag: Event<void>;
|
|
345
|
-
/** Event that fires when the user stops dragging a clipping plane. */
|
|
346
|
-
readonly onAfterDrag: Event<void>;
|
|
347
|
-
/**
|
|
348
|
-
* Event that fires when the user starts creating a clipping plane.
|
|
349
|
-
*/
|
|
350
|
-
readonly onBeforeCreate: Event<unknown>;
|
|
351
|
-
/**
|
|
352
|
-
* Event that fires when the user cancels the creation of a clipping plane.
|
|
353
|
-
*/
|
|
354
|
-
readonly onBeforeCancel: Event<unknown>;
|
|
355
|
-
/**
|
|
356
|
-
* Event that fires after the user cancels the creation of a clipping plane.
|
|
357
|
-
*/
|
|
358
|
-
readonly onAfterCancel: Event<unknown>;
|
|
359
|
-
/**
|
|
360
|
-
* Event that fires when the user starts deleting a clipping plane.
|
|
361
|
-
*/
|
|
362
|
-
readonly onBeforeDelete: Event<unknown>;
|
|
363
|
-
/**
|
|
364
|
-
* Event that fires after a clipping plane has been created.
|
|
365
|
-
* @param plane - The newly created clipping plane.
|
|
366
|
-
*/
|
|
367
|
-
readonly onAfterCreate: Event<SimplePlane>;
|
|
368
|
-
/**
|
|
369
|
-
* Event that fires after a clipping plane has been deleted.
|
|
370
|
-
* @param plane - The deleted clipping plane.
|
|
371
|
-
*/
|
|
372
|
-
readonly onAfterDelete: Event<SimplePlane>;
|
|
390
|
+
static readonly uuid: "a659add7-1418-4771-a0d6-7d4d438e4624";
|
|
373
391
|
/** {@link Disposable.onDisposed} */
|
|
374
392
|
readonly onDisposed: Event<string>;
|
|
375
393
|
/**
|
|
376
|
-
*
|
|
377
|
-
* (up). This is desirable when clipping a building horizontally and a
|
|
378
|
-
* clipping plane is created in its roof, which might have a slight
|
|
379
|
-
* slope for draining purposes.
|
|
394
|
+
* An event triggered when the IFC file starts loading.
|
|
380
395
|
*/
|
|
381
|
-
|
|
396
|
+
readonly onIfcStartedLoading: Event<void>;
|
|
382
397
|
/**
|
|
383
|
-
*
|
|
384
|
-
* will be forced to be orthogonal to the Y direction. {@link orthogonalY}
|
|
385
|
-
* has to be 'true' for this to apply.
|
|
398
|
+
* An event triggered when the setup process is completed.
|
|
386
399
|
*/
|
|
387
|
-
|
|
400
|
+
readonly onSetup: Event<void>;
|
|
388
401
|
/**
|
|
389
|
-
* The
|
|
390
|
-
*
|
|
402
|
+
* The settings for the IfcLoader.
|
|
403
|
+
* It includes options for excluding categories, setting WASM paths, and more.
|
|
391
404
|
*/
|
|
392
|
-
|
|
405
|
+
settings: IfcFragmentSettings;
|
|
393
406
|
/**
|
|
394
|
-
*
|
|
407
|
+
* The instance of the Web-IFC library used for handling IFC data.
|
|
395
408
|
*/
|
|
396
|
-
|
|
397
|
-
/** The material used in all the clipping planes. */
|
|
398
|
-
private _material;
|
|
399
|
-
private _size;
|
|
400
|
-
private _enabled;
|
|
401
|
-
private _visible;
|
|
402
|
-
/** {@link Component.enabled} */
|
|
403
|
-
get enabled(): boolean;
|
|
409
|
+
webIfc: WEBIFC.IfcAPI;
|
|
404
410
|
/** {@link Component.enabled} */
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
set material(material: THREE.MeshBasicMaterial);
|
|
414
|
-
/** The size of the geometric representation of the clippings planes. */
|
|
415
|
-
get size(): number;
|
|
416
|
-
/** The size of the geometric representation of the clippings planes. */
|
|
417
|
-
set size(size: number);
|
|
411
|
+
enabled: boolean;
|
|
412
|
+
private _material;
|
|
413
|
+
private _spatialTree;
|
|
414
|
+
private _metaData;
|
|
415
|
+
private _fragmentInstances;
|
|
416
|
+
private _civil;
|
|
417
|
+
private _visitedFragments;
|
|
418
|
+
private _materialT;
|
|
418
419
|
constructor(components: Components);
|
|
419
420
|
/** {@link Disposable.dispose} */
|
|
420
421
|
dispose(): void;
|
|
421
|
-
/** {@link Createable.create} */
|
|
422
|
-
create(world: World): void;
|
|
423
422
|
/**
|
|
424
|
-
*
|
|
425
|
-
* without the need of the mouse.
|
|
423
|
+
* Sets up the IfcLoader component with the provided configuration.
|
|
426
424
|
*
|
|
427
|
-
* @param
|
|
428
|
-
*
|
|
429
|
-
* @param point - the position of the clipping plane.
|
|
430
|
-
* navigation.
|
|
431
|
-
*/
|
|
432
|
-
createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
|
|
433
|
-
/**
|
|
434
|
-
* {@link Createable.delete}
|
|
425
|
+
* @param config - Optional configuration settings for the IfcLoader.
|
|
426
|
+
* If not provided, the existing settings will be used.
|
|
435
427
|
*
|
|
436
|
-
* @
|
|
437
|
-
* @param plane - the plane to delete. If undefined, the first plane
|
|
438
|
-
* found under the cursor will be deleted.
|
|
439
|
-
*/
|
|
440
|
-
delete(world: World, plane?: SimplePlane): void;
|
|
441
|
-
/** Deletes all the existing clipping planes. */
|
|
442
|
-
deleteAll(): void;
|
|
443
|
-
private deletePlane;
|
|
444
|
-
private pickPlane;
|
|
445
|
-
private getAllPlaneMeshes;
|
|
446
|
-
private createPlaneFromIntersection;
|
|
447
|
-
private getWorldNormal;
|
|
448
|
-
private normalizePlaneDirectionY;
|
|
449
|
-
private newPlane;
|
|
450
|
-
private updateMaterialsAndPlanes;
|
|
451
|
-
private _onStartDragging;
|
|
452
|
-
private _onEndDragging;
|
|
453
|
-
}
|
|
454
|
-
import * as THREE from "three";
|
|
455
|
-
import { Components } from "../Components";
|
|
456
|
-
import { SimpleCamera } from "..";
|
|
457
|
-
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
458
|
-
/**
|
|
459
|
-
* A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
|
|
460
|
-
*/
|
|
461
|
-
export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
462
|
-
/**
|
|
463
|
-
* A ProjectionManager instance that manages the projection modes of the camera.
|
|
464
|
-
*/
|
|
465
|
-
readonly projection: ProjectionManager;
|
|
466
|
-
/**
|
|
467
|
-
* A THREE.OrthographicCamera instance that represents the orthographic camera.
|
|
468
|
-
* This camera is used when the projection mode is set to orthographic.
|
|
469
|
-
*/
|
|
470
|
-
readonly threeOrtho: THREE.OrthographicCamera;
|
|
471
|
-
/**
|
|
472
|
-
* A THREE.PerspectiveCamera instance that represents the perspective camera.
|
|
473
|
-
* This camera is used when the projection mode is set to perspective.
|
|
474
|
-
*/
|
|
475
|
-
readonly threePersp: THREE.PerspectiveCamera;
|
|
476
|
-
protected readonly _userInputButtons: any;
|
|
477
|
-
protected readonly _frustumSize = 50;
|
|
478
|
-
protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
|
|
479
|
-
protected _mode: NavigationMode | null;
|
|
480
|
-
private previousSize;
|
|
481
|
-
/**
|
|
482
|
-
* Getter for the current navigation mode.
|
|
483
|
-
* Throws an error if the mode is not found or the camera is not initialized.
|
|
428
|
+
* @returns A Promise that resolves when the setup process is completed.
|
|
484
429
|
*
|
|
485
|
-
* @
|
|
430
|
+
* @remarks
|
|
431
|
+
* If the 'autoSetWasm' option is enabled in the configuration,
|
|
432
|
+
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
486
433
|
*
|
|
487
|
-
* @
|
|
434
|
+
* @example
|
|
435
|
+
* '''typescript
|
|
436
|
+
* const ifcLoader = new IfcLoader(components);
|
|
437
|
+
* await ifcLoader.setup({ autoSetWasm: true });
|
|
438
|
+
* '''
|
|
488
439
|
*/
|
|
489
|
-
|
|
490
|
-
constructor(components: Components);
|
|
491
|
-
/** {@link Disposable.dispose} */
|
|
492
|
-
dispose(): void;
|
|
440
|
+
setup(config?: Partial<IfcFragmentSettings>): Promise<void>;
|
|
493
441
|
/**
|
|
494
|
-
*
|
|
442
|
+
* Loads an IFC file and processes it for 3D visualization.
|
|
495
443
|
*
|
|
496
|
-
* @param
|
|
444
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
445
|
+
* @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
|
|
446
|
+
*
|
|
447
|
+
* @returns A Promise that resolves to the FragmentsGroup containing the loaded and processed IFC data.
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* '''typescript
|
|
451
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
452
|
+
* const group = await ifcLoader.load(ifcData);
|
|
453
|
+
* '''
|
|
497
454
|
*/
|
|
498
|
-
|
|
455
|
+
load(data: Uint8Array, coordinate?: boolean): Promise<FRAGS.FragmentsGroup>;
|
|
499
456
|
/**
|
|
500
|
-
*
|
|
457
|
+
* Reads an IFC file and initializes the Web-IFC library.
|
|
501
458
|
*
|
|
502
|
-
* @param
|
|
503
|
-
*
|
|
504
|
-
* @
|
|
459
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
460
|
+
*
|
|
461
|
+
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
462
|
+
*
|
|
463
|
+
* @remarks
|
|
464
|
+
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
465
|
+
* It also opens the IFC model using the provided data and settings.
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* '''typescript
|
|
469
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
470
|
+
* await ifcLoader.readIfcFile(ifcData);
|
|
471
|
+
* '''
|
|
505
472
|
*/
|
|
506
|
-
|
|
473
|
+
readIfcFile(data: Uint8Array): Promise<number>;
|
|
507
474
|
/**
|
|
508
|
-
*
|
|
475
|
+
* Cleans up the IfcLoader component by resetting the Web-IFC library,
|
|
476
|
+
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
509
477
|
*
|
|
510
|
-
* @
|
|
478
|
+
* @remarks
|
|
479
|
+
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* '''typescript
|
|
483
|
+
* const ifcLoader = components.get(IfcLoader);
|
|
484
|
+
* ifcLoader.cleanUp();
|
|
485
|
+
* '''
|
|
511
486
|
*/
|
|
512
|
-
|
|
513
|
-
private
|
|
514
|
-
private
|
|
515
|
-
private
|
|
516
|
-
private
|
|
487
|
+
cleanUp(): void;
|
|
488
|
+
private getAllGeometries;
|
|
489
|
+
private getMesh;
|
|
490
|
+
private getGeometry;
|
|
491
|
+
private autoSetWasm;
|
|
517
492
|
}
|
|
518
|
-
import
|
|
519
|
-
import {
|
|
520
|
-
import {
|
|
493
|
+
import * as WEBIFC from "web-ifc";
|
|
494
|
+
import { Components, Disposable, Event, Component } from "../../core";
|
|
495
|
+
import { IfcStreamingSettings, StreamedGeometries, StreamedAsset } from "./src";
|
|
521
496
|
/**
|
|
522
|
-
* A component that
|
|
497
|
+
* A component that handles the tiling of IFC geometries for efficient streaming. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/IfcGeometryTiler). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/IfcGeometryTiler).
|
|
523
498
|
*/
|
|
524
|
-
export declare class
|
|
499
|
+
export declare class IfcGeometryTiler extends Component implements Disposable {
|
|
525
500
|
/**
|
|
526
501
|
* A unique identifier for the component.
|
|
527
502
|
* This UUID is used to register the component within the Components system.
|
|
528
503
|
*/
|
|
529
|
-
static readonly uuid: "
|
|
504
|
+
static readonly uuid: "d9999a00-e1f5-4d3f-8cfe-c56e08609764";
|
|
530
505
|
/**
|
|
531
|
-
*
|
|
506
|
+
* Event triggered when geometry is streamed.
|
|
507
|
+
* Contains the streamed geometry data and its buffer.
|
|
532
508
|
*/
|
|
533
|
-
|
|
509
|
+
readonly onGeometryStreamed: Event<{
|
|
510
|
+
buffer: Uint8Array;
|
|
511
|
+
data: StreamedGeometries;
|
|
512
|
+
}>;
|
|
534
513
|
/**
|
|
535
|
-
*
|
|
514
|
+
* Event triggered when assets are streamed.
|
|
515
|
+
* Contains the streamed assets.
|
|
536
516
|
*/
|
|
537
|
-
|
|
517
|
+
readonly onAssetStreamed: Event<StreamedAsset[]>;
|
|
518
|
+
/**
|
|
519
|
+
* Event triggered to indicate the progress of the streaming process.
|
|
520
|
+
* Contains the progress percentage.
|
|
521
|
+
*/
|
|
522
|
+
readonly onProgress: Event<number>;
|
|
523
|
+
/**
|
|
524
|
+
* Event triggered when the IFC file is loaded.
|
|
525
|
+
* Contains the loaded IFC file data.
|
|
526
|
+
*/
|
|
527
|
+
readonly onIfcLoaded: Event<Uint8Array>;
|
|
538
528
|
/** {@link Disposable.onDisposed} */
|
|
539
529
|
readonly onDisposed: Event<unknown>;
|
|
530
|
+
/**
|
|
531
|
+
* Settings for the IfcGeometryTiler.
|
|
532
|
+
*/
|
|
533
|
+
settings: IfcStreamingSettings;
|
|
540
534
|
/** {@link Component.enabled} */
|
|
541
535
|
enabled: boolean;
|
|
542
|
-
constructor(components: Components);
|
|
543
536
|
/**
|
|
544
|
-
*
|
|
545
|
-
|
|
537
|
+
* The WebIFC API instance used for IFC file processing.
|
|
538
|
+
*/
|
|
539
|
+
webIfc: WEBIFC.IfcAPI;
|
|
540
|
+
private _spatialTree;
|
|
541
|
+
private _metaData;
|
|
542
|
+
private _visitedGeometries;
|
|
543
|
+
private _streamSerializer;
|
|
544
|
+
private _geometries;
|
|
545
|
+
private _geometryCount;
|
|
546
|
+
private _civil;
|
|
547
|
+
private _groupSerializer;
|
|
548
|
+
private _assets;
|
|
549
|
+
private _meshesWithHoles;
|
|
550
|
+
constructor(components: Components);
|
|
551
|
+
/** {@link Disposable.dispose} */
|
|
552
|
+
dispose(): void;
|
|
553
|
+
/**
|
|
554
|
+
* This method streams the IFC file from a given buffer.
|
|
546
555
|
*
|
|
547
|
-
* @param
|
|
548
|
-
* @returns
|
|
556
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
557
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
549
558
|
*
|
|
550
|
-
* @
|
|
559
|
+
* @remarks
|
|
560
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
561
|
+
*
|
|
562
|
+
* @example
|
|
563
|
+
* '''typescript
|
|
564
|
+
* const ifcData = await fetch('path/to/ifc/file.ifc');
|
|
565
|
+
* const rawBuffer = await response.arrayBuffer();
|
|
566
|
+
* const ifcBuffer = new Uint8Array(rawBuffer);
|
|
567
|
+
* await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
|
|
568
|
+
* '''
|
|
551
569
|
*/
|
|
552
|
-
|
|
570
|
+
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
553
571
|
/**
|
|
554
|
-
*
|
|
555
|
-
* If a grid does not exist for the given world, this method does nothing.
|
|
572
|
+
* This method streams the IFC file from a given callback.
|
|
556
573
|
*
|
|
557
|
-
* @param
|
|
574
|
+
* @param loadCallback - The callback function that will be used to load the IFC file.
|
|
575
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
558
576
|
*
|
|
559
577
|
* @remarks
|
|
560
|
-
* This method
|
|
561
|
-
*
|
|
578
|
+
* This method cleans up any resources after the streaming process is complete.
|
|
579
|
+
*
|
|
562
580
|
*/
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
581
|
+
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
582
|
+
private readIfcFile;
|
|
583
|
+
private streamIfcFile;
|
|
584
|
+
private streamAllGeometries;
|
|
585
|
+
private cleanUp;
|
|
586
|
+
private getMesh;
|
|
587
|
+
private getGeometry;
|
|
588
|
+
private streamAssets;
|
|
589
|
+
private streamGeometries;
|
|
566
590
|
}
|
|
567
591
|
import * as THREE from "three";
|
|
568
592
|
import * as FRAGS from "@thatopen/fragments";
|
|
@@ -772,764 +796,832 @@ export declare class BoundingBoxer extends Component implements Disposable {
|
|
|
772
796
|
addFragmentIdMap(fragmentIdMap: FRAGS.FragmentIdMap): void;
|
|
773
797
|
private static getFragmentBounds;
|
|
774
798
|
}
|
|
775
|
-
|
|
776
|
-
import
|
|
777
|
-
|
|
778
|
-
center: THREE.Vector3;
|
|
779
|
-
halfSizes: THREE.Vector3;
|
|
780
|
-
rotation: THREE.Matrix3;
|
|
781
|
-
transformation: THREE.Matrix4;
|
|
782
|
-
};
|
|
783
|
-
import { Component, Disposable, Event, Components } from "../../core";
|
|
799
|
+
import * as WEBIFC from "web-ifc";
|
|
800
|
+
import { AsyncEvent, Component, Disposable, Event } from "../../core";
|
|
801
|
+
import { PropertiesStreamingSettings } from "./src";
|
|
784
802
|
/**
|
|
785
|
-
*
|
|
803
|
+
* 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).
|
|
786
804
|
*/
|
|
787
|
-
export declare class
|
|
805
|
+
export declare class IfcPropertiesTiler extends Component implements Disposable {
|
|
788
806
|
/**
|
|
789
807
|
* A unique identifier for the component.
|
|
790
808
|
* This UUID is used to register the component within the Components system.
|
|
791
809
|
*/
|
|
792
|
-
static readonly uuid: "
|
|
810
|
+
static readonly uuid: "88d2c89c-ce32-47d7-8cb6-d51e4b311a0b";
|
|
811
|
+
/**
|
|
812
|
+
* An event that is triggered when properties are streamed from the IFC file.
|
|
813
|
+
* The event provides the type of the IFC entity and the corresponding data.
|
|
814
|
+
*/
|
|
815
|
+
readonly onPropertiesStreamed: AsyncEvent<{
|
|
816
|
+
type: number;
|
|
817
|
+
data: {
|
|
818
|
+
[id: number]: any;
|
|
819
|
+
};
|
|
820
|
+
}>;
|
|
821
|
+
/**
|
|
822
|
+
* An event that is triggered to indicate the progress of the streaming process.
|
|
823
|
+
* The event provides a number between 0 and 1 representing the progress percentage.
|
|
824
|
+
*/
|
|
825
|
+
readonly onProgress: AsyncEvent<number>;
|
|
826
|
+
/**
|
|
827
|
+
* An event that is triggered when indices are streamed from the IFC file.
|
|
828
|
+
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
829
|
+
*/
|
|
830
|
+
readonly onIndicesStreamed: AsyncEvent<Map<number, Map<number, number[]>>>;
|
|
793
831
|
/** {@link Disposable.onDisposed} */
|
|
794
|
-
readonly onDisposed: Event<
|
|
832
|
+
readonly onDisposed: Event<string>;
|
|
795
833
|
/** {@link Component.enabled} */
|
|
796
834
|
enabled: boolean;
|
|
797
835
|
/**
|
|
798
|
-
*
|
|
799
|
-
* This property determines the vertical distance by which fragments are moved during the explosion.
|
|
800
|
-
* Default value is 10.
|
|
801
|
-
*/
|
|
802
|
-
height: number;
|
|
803
|
-
/**
|
|
804
|
-
* The group name used for the explosion animation.
|
|
805
|
-
* This property specifies the group of fragments that will be affected by the explosion.
|
|
806
|
-
* Default value is "storeys".
|
|
836
|
+
* An instance of the PropertiesStreamingSettings class, which holds the settings for the streaming process.
|
|
807
837
|
*/
|
|
808
|
-
|
|
838
|
+
settings: PropertiesStreamingSettings;
|
|
809
839
|
/**
|
|
810
|
-
*
|
|
811
|
-
* This set is used to keep track of which items have been exploded.
|
|
840
|
+
* An instance of the IfcAPI class from the Web-IFC library, which provides methods for reading and processing IFC data.
|
|
812
841
|
*/
|
|
813
|
-
|
|
814
|
-
constructor(components: Components);
|
|
842
|
+
webIfc: WEBIFC.IfcAPI;
|
|
815
843
|
/** {@link Disposable.dispose} */
|
|
816
|
-
dispose(): void
|
|
844
|
+
dispose(): Promise<void>;
|
|
817
845
|
/**
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
* @param active - A boolean indicating whether to activate or deactivate the explosion.
|
|
821
|
-
*
|
|
822
|
-
* @remarks
|
|
823
|
-
* This method applies a vertical transformation to the fragments based on the 'active' parameter.
|
|
824
|
-
* If 'active' is true, the fragments are moved upwards by a distance determined by the 'height' property.
|
|
825
|
-
* If 'active' is false, the fragments are moved back to their original position.
|
|
846
|
+
* This method converts properties from an IFC file to tiles given its data as a Uint8Array.
|
|
826
847
|
*
|
|
827
|
-
*
|
|
848
|
+
* @param data - The Uint8Array containing the IFC file data.
|
|
849
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
850
|
+
*/
|
|
851
|
+
streamFromBuffer(data: Uint8Array): Promise<void>;
|
|
852
|
+
/**
|
|
853
|
+
* This method converts properties from an IFC file to tiles using a given callback function to read the file.
|
|
828
854
|
*
|
|
829
|
-
* @
|
|
855
|
+
* @param loadCallback - A callback function that loads the IFC file data.
|
|
856
|
+
* @returns A Promise that resolves when the streaming process is complete.
|
|
830
857
|
*/
|
|
831
|
-
|
|
858
|
+
streamFromCallBack(loadCallback: WEBIFC.ModelLoadCallback): Promise<void>;
|
|
859
|
+
private readIfcFile;
|
|
860
|
+
private streamIfcFile;
|
|
861
|
+
private streamAllProperties;
|
|
862
|
+
private cleanUp;
|
|
832
863
|
}
|
|
833
|
-
|
|
834
|
-
|
|
864
|
+
export declare class UUID {
|
|
865
|
+
private static _pattern;
|
|
866
|
+
private static _lut;
|
|
867
|
+
static create(): string;
|
|
868
|
+
static validate(uuid: string): void;
|
|
869
|
+
}
|
|
870
|
+
import * as THREE from "three";
|
|
871
|
+
import { Component, Components, Disposable, Event, World } from "../core";
|
|
835
872
|
/**
|
|
836
|
-
*
|
|
873
|
+
* Configuration interface for the VertexPicker component.
|
|
837
874
|
*/
|
|
838
|
-
export
|
|
875
|
+
export interface VertexPickerConfig {
|
|
839
876
|
/**
|
|
840
|
-
*
|
|
841
|
-
* This UUID is used to register the component within the Components system.
|
|
877
|
+
* If true, only vertices will be picked, not the closest point on the face.
|
|
842
878
|
*/
|
|
843
|
-
|
|
844
|
-
/** {@link Component.enabled} */
|
|
845
|
-
enabled: boolean;
|
|
846
|
-
constructor(components: Components);
|
|
879
|
+
showOnlyVertex: boolean;
|
|
847
880
|
/**
|
|
848
|
-
*
|
|
849
|
-
* If no 'items' parameter is provided, all fragments will be set to the specified visibility.
|
|
850
|
-
* If 'items' is provided, only the specified fragments will be affected.
|
|
851
|
-
*
|
|
852
|
-
* @param visible - The visibility state to set for the fragments.
|
|
853
|
-
* @param items - An optional map of fragment IDs and their corresponding sub-fragment IDs to be affected.
|
|
854
|
-
* If not provided, all fragments will be affected.
|
|
855
|
-
*
|
|
856
|
-
* @returns {void}
|
|
881
|
+
* The maximum distance for snapping to a vertex.
|
|
857
882
|
*/
|
|
858
|
-
|
|
883
|
+
snapDistance: number;
|
|
859
884
|
/**
|
|
860
|
-
*
|
|
861
|
-
* It calls the 'set' method twice: first to hide all fragments, and then to show only the specified ones.
|
|
862
|
-
*
|
|
863
|
-
* @param items - A map of fragment IDs and their corresponding sub-fragment IDs to be isolated.
|
|
864
|
-
* If not provided, all fragments will be isolated.
|
|
865
|
-
*
|
|
866
|
-
* @returns {void}
|
|
885
|
+
* The HTML element to use for previewing the picked vertex.
|
|
867
886
|
*/
|
|
868
|
-
|
|
869
|
-
private updateCulledVisibility;
|
|
870
|
-
}
|
|
871
|
-
import * as THREE from "three";
|
|
872
|
-
export declare class MaterialsUtils {
|
|
873
|
-
static isTransparent(material: THREE.Material): boolean;
|
|
887
|
+
previewElement: HTMLElement;
|
|
874
888
|
}
|
|
875
|
-
import * as WEBIFC from "web-ifc";
|
|
876
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
877
|
-
import { IfcFragmentSettings } from "./src";
|
|
878
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
879
889
|
/**
|
|
880
|
-
*
|
|
890
|
+
* A class that provides functionality for picking vertices in a 3D scene.
|
|
881
891
|
*/
|
|
882
|
-
export declare class
|
|
892
|
+
export declare class VertexPicker extends Component implements Disposable {
|
|
893
|
+
/** {@link Disposable.onDisposed} */
|
|
894
|
+
readonly onDisposed: Event<unknown>;
|
|
883
895
|
/**
|
|
884
|
-
*
|
|
885
|
-
*
|
|
896
|
+
* An event that is triggered when a vertex is found.
|
|
897
|
+
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
886
898
|
*/
|
|
887
|
-
|
|
888
|
-
/** {@link Disposable.onDisposed} */
|
|
889
|
-
readonly onDisposed: Event<string>;
|
|
899
|
+
readonly onVertexFound: Event<THREE.Vector3>;
|
|
890
900
|
/**
|
|
891
|
-
* An event triggered when
|
|
901
|
+
* An event that is triggered when a vertex is lost.
|
|
902
|
+
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
892
903
|
*/
|
|
893
|
-
readonly
|
|
904
|
+
readonly onVertexLost: Event<THREE.Vector3>;
|
|
894
905
|
/**
|
|
895
|
-
* An event triggered when the
|
|
906
|
+
* An event that is triggered when the picker is enabled or disabled
|
|
896
907
|
*/
|
|
897
|
-
readonly
|
|
908
|
+
readonly onEnabled: Event<boolean>;
|
|
898
909
|
/**
|
|
899
|
-
*
|
|
900
|
-
* It includes options for excluding categories, setting WASM paths, and more.
|
|
910
|
+
* A reference to the Components instance associated with this VertexPicker.
|
|
901
911
|
*/
|
|
902
|
-
|
|
912
|
+
components: Components;
|
|
903
913
|
/**
|
|
904
|
-
*
|
|
914
|
+
* A reference to the working plane used for vertex picking.
|
|
915
|
+
* This plane is used to determine which vertices are considered valid for picking.
|
|
916
|
+
* If this value is null, all vertices are considered valid.
|
|
905
917
|
*/
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
private
|
|
910
|
-
private _spatialTree;
|
|
911
|
-
private _metaData;
|
|
912
|
-
private _fragmentInstances;
|
|
913
|
-
private _civil;
|
|
914
|
-
private _visitedFragments;
|
|
915
|
-
private _materialT;
|
|
916
|
-
constructor(components: Components);
|
|
917
|
-
/** {@link Disposable.dispose} */
|
|
918
|
-
dispose(): void;
|
|
918
|
+
workingPlane: THREE.Plane | null;
|
|
919
|
+
private _pickedPoint;
|
|
920
|
+
private _config;
|
|
921
|
+
private _enabled;
|
|
919
922
|
/**
|
|
920
|
-
* Sets
|
|
923
|
+
* Sets the enabled state of the VertexPicker.
|
|
924
|
+
* When enabled, the VertexPicker will actively search for vertices in the 3D scene.
|
|
925
|
+
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
921
926
|
*
|
|
922
|
-
* @param
|
|
923
|
-
|
|
927
|
+
* @param value - The new enabled state.
|
|
928
|
+
*/
|
|
929
|
+
set enabled(value: boolean);
|
|
930
|
+
/**
|
|
931
|
+
* Gets the current enabled state of the VertexPicker.
|
|
924
932
|
*
|
|
925
|
-
* @returns
|
|
926
|
-
*
|
|
927
|
-
* @remarks
|
|
928
|
-
* If the 'autoSetWasm' option is enabled in the configuration,
|
|
929
|
-
* the method will automatically set the WASM paths for the Web-IFC library.
|
|
930
|
-
*
|
|
931
|
-
* @example
|
|
932
|
-
* '''typescript
|
|
933
|
-
* const ifcLoader = new IfcLoader(components);
|
|
934
|
-
* await ifcLoader.setup({ autoSetWasm: true });
|
|
935
|
-
* '''
|
|
933
|
+
* @returns The current enabled state.
|
|
936
934
|
*/
|
|
937
|
-
|
|
935
|
+
get enabled(): boolean;
|
|
938
936
|
/**
|
|
939
|
-
*
|
|
940
|
-
*
|
|
941
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
942
|
-
* @param coordinate - Optional boolean indicating whether to coordinate the loaded IFC data. Default is true.
|
|
937
|
+
* Sets the configuration for the VertexPicker component.
|
|
943
938
|
*
|
|
944
|
-
* @
|
|
939
|
+
* @param value - A Partial object containing the configuration properties to update.
|
|
940
|
+
* The properties not provided in the value object will retain their current values.
|
|
945
941
|
*
|
|
946
942
|
* @example
|
|
947
943
|
* '''typescript
|
|
948
|
-
*
|
|
949
|
-
*
|
|
944
|
+
* vertexPicker.config = {
|
|
945
|
+
* snapDistance: 0.5,
|
|
946
|
+
* showOnlyVertex: true,
|
|
947
|
+
* };
|
|
950
948
|
* '''
|
|
951
949
|
*/
|
|
952
|
-
|
|
950
|
+
set config(value: Partial<VertexPickerConfig>);
|
|
953
951
|
/**
|
|
954
|
-
*
|
|
955
|
-
*
|
|
956
|
-
* @param data - The Uint8Array containing the IFC file data.
|
|
957
|
-
*
|
|
958
|
-
* @returns A Promise that resolves when the IFC file is opened and initialized.
|
|
952
|
+
* Gets the current configuration for the VertexPicker component.
|
|
959
953
|
*
|
|
960
|
-
* @
|
|
961
|
-
* This method sets the WASM path and initializes the Web-IFC library based on the provided settings.
|
|
962
|
-
* It also opens the IFC model using the provided data and settings.
|
|
954
|
+
* @returns A copy of the current VertexPickerConfig object.
|
|
963
955
|
*
|
|
964
956
|
* @example
|
|
965
957
|
* '''typescript
|
|
966
|
-
* const
|
|
967
|
-
*
|
|
958
|
+
* const currentConfig = vertexPicker.config;
|
|
959
|
+
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
968
960
|
* '''
|
|
969
961
|
*/
|
|
970
|
-
|
|
962
|
+
get config(): Partial<VertexPickerConfig>;
|
|
963
|
+
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
964
|
+
/** {@link Disposable.dispose} */
|
|
965
|
+
dispose(): void;
|
|
971
966
|
/**
|
|
972
|
-
*
|
|
973
|
-
* clearing the visited fragments and fragment instances maps, and creating a new instance of the Web-IFC library.
|
|
967
|
+
* Performs the vertex picking operation based on the current state of the VertexPicker.
|
|
974
968
|
*
|
|
975
|
-
* @
|
|
976
|
-
* This method is called automatically after using the .load() method, so usually you don't need to use it manually.
|
|
969
|
+
* @param world - The World instance to use for raycasting.
|
|
977
970
|
*
|
|
978
|
-
* @
|
|
979
|
-
*
|
|
980
|
-
*
|
|
981
|
-
*
|
|
982
|
-
*
|
|
971
|
+
* @returns The current picked point, or null if no point is picked.
|
|
972
|
+
*
|
|
973
|
+
* @remarks
|
|
974
|
+
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
975
|
+
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
976
|
+
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
977
|
+
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
978
|
+
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
979
|
+
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
983
980
|
*/
|
|
984
|
-
|
|
985
|
-
private
|
|
986
|
-
private
|
|
987
|
-
private
|
|
988
|
-
private autoSetWasm;
|
|
981
|
+
get(world: World): THREE.Vector3 | null;
|
|
982
|
+
private getClosestVertex;
|
|
983
|
+
private getVertices;
|
|
984
|
+
private getVertex;
|
|
989
985
|
}
|
|
986
|
+
import * as THREE from "three";
|
|
987
|
+
export declare function obbFromPoints(vertices: ArrayLike<number>): {
|
|
988
|
+
center: THREE.Vector3;
|
|
989
|
+
halfSizes: THREE.Vector3;
|
|
990
|
+
rotation: THREE.Matrix3;
|
|
991
|
+
transformation: THREE.Matrix4;
|
|
992
|
+
};
|
|
990
993
|
import * as WEBIFC from "web-ifc";
|
|
991
|
-
import {
|
|
992
|
-
import {
|
|
994
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
995
|
+
import { Component, Disposable, Event, Components } from "../../core";
|
|
993
996
|
/**
|
|
994
|
-
*
|
|
997
|
+
* Types for boolean properties in IFC schema.
|
|
995
998
|
*/
|
|
996
|
-
export
|
|
999
|
+
export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
1000
|
+
/**
|
|
1001
|
+
* Types for string properties in IFC schema.
|
|
1002
|
+
*/
|
|
1003
|
+
export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
1004
|
+
/**
|
|
1005
|
+
* Types for numeric properties in IFC schema.
|
|
1006
|
+
*/
|
|
1007
|
+
export type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
1008
|
+
/**
|
|
1009
|
+
* 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.
|
|
1010
|
+
*/
|
|
1011
|
+
export interface ChangeMap {
|
|
1012
|
+
[modelID: string]: Set<number>;
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* 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.
|
|
1016
|
+
*/
|
|
1017
|
+
export interface AttributeListener {
|
|
1018
|
+
[modelID: string]: {
|
|
1019
|
+
[expressID: number]: {
|
|
1020
|
+
[attributeName: string]: Event<String | Boolean | Number>;
|
|
1021
|
+
};
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Component to manage and edit properties and Psets in IFC files.
|
|
1026
|
+
*/
|
|
1027
|
+
export declare class IfcPropertiesManager extends Component implements Disposable {
|
|
997
1028
|
/**
|
|
998
1029
|
* A unique identifier for the component.
|
|
999
1030
|
* This UUID is used to register the component within the Components system.
|
|
1000
1031
|
*/
|
|
1001
|
-
static readonly uuid: "
|
|
1032
|
+
static readonly uuid: "58c2d9f0-183c-48d6-a402-dfcf5b9a34df";
|
|
1033
|
+
/** {@link Disposable.onDisposed} */
|
|
1034
|
+
readonly onDisposed: Event<string>;
|
|
1002
1035
|
/**
|
|
1003
|
-
* Event triggered when
|
|
1004
|
-
* Contains the streamed geometry data and its buffer.
|
|
1036
|
+
* Event triggered when a file is requested for export.
|
|
1005
1037
|
*/
|
|
1006
|
-
readonly
|
|
1007
|
-
|
|
1008
|
-
|
|
1038
|
+
readonly onRequestFile: Event<unknown>;
|
|
1039
|
+
/**
|
|
1040
|
+
* ArrayBuffer containing the IFC data to be exported.
|
|
1041
|
+
*/
|
|
1042
|
+
ifcToExport: ArrayBuffer | null;
|
|
1043
|
+
/**
|
|
1044
|
+
* Event triggered when an element is added to a Pset.
|
|
1045
|
+
*/
|
|
1046
|
+
readonly onElementToPset: Event<{
|
|
1047
|
+
model: FragmentsGroup;
|
|
1048
|
+
psetID: number;
|
|
1049
|
+
elementID: number;
|
|
1009
1050
|
}>;
|
|
1010
1051
|
/**
|
|
1011
|
-
* Event triggered when
|
|
1012
|
-
* Contains the streamed assets.
|
|
1052
|
+
* Event triggered when a property is added to a Pset.
|
|
1013
1053
|
*/
|
|
1014
|
-
readonly
|
|
1054
|
+
readonly onPropToPset: Event<{
|
|
1055
|
+
model: FragmentsGroup;
|
|
1056
|
+
psetID: number;
|
|
1057
|
+
propID: number;
|
|
1058
|
+
}>;
|
|
1015
1059
|
/**
|
|
1016
|
-
* Event triggered
|
|
1017
|
-
* Contains the progress percentage.
|
|
1060
|
+
* Event triggered when a Pset is removed.
|
|
1018
1061
|
*/
|
|
1019
|
-
readonly
|
|
1062
|
+
readonly onPsetRemoved: Event<{
|
|
1063
|
+
model: FragmentsGroup;
|
|
1064
|
+
psetID: number;
|
|
1065
|
+
}>;
|
|
1020
1066
|
/**
|
|
1021
|
-
* Event triggered when
|
|
1022
|
-
* Contains the loaded IFC file data.
|
|
1067
|
+
* Event triggered when data in the model changes.
|
|
1023
1068
|
*/
|
|
1024
|
-
readonly
|
|
1025
|
-
|
|
1026
|
-
|
|
1069
|
+
readonly onDataChanged: Event<{
|
|
1070
|
+
model: FragmentsGroup;
|
|
1071
|
+
expressID: number;
|
|
1072
|
+
}>;
|
|
1027
1073
|
/**
|
|
1028
|
-
*
|
|
1074
|
+
* Configuration for the WebAssembly module.
|
|
1029
1075
|
*/
|
|
1030
|
-
|
|
1076
|
+
wasm: {
|
|
1077
|
+
path: string;
|
|
1078
|
+
absolute: boolean;
|
|
1079
|
+
};
|
|
1031
1080
|
/** {@link Component.enabled} */
|
|
1032
1081
|
enabled: boolean;
|
|
1033
1082
|
/**
|
|
1034
|
-
*
|
|
1083
|
+
* Map of attribute listeners.
|
|
1035
1084
|
*/
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
private _assets;
|
|
1046
|
-
private _meshesWithHoles;
|
|
1085
|
+
attributeListeners: AttributeListener;
|
|
1086
|
+
/**
|
|
1087
|
+
* The currently selected model.
|
|
1088
|
+
*/
|
|
1089
|
+
selectedModel?: FragmentsGroup;
|
|
1090
|
+
/**
|
|
1091
|
+
* Map of changed entities in the model.
|
|
1092
|
+
*/
|
|
1093
|
+
changeMap: ChangeMap;
|
|
1047
1094
|
constructor(components: Components);
|
|
1048
1095
|
/** {@link Disposable.dispose} */
|
|
1049
1096
|
dispose(): void;
|
|
1050
1097
|
/**
|
|
1051
|
-
*
|
|
1098
|
+
* Static method to retrieve the IFC schema from a given model.
|
|
1052
1099
|
*
|
|
1053
|
-
* @param
|
|
1054
|
-
* @
|
|
1100
|
+
* @param model - The FragmentsGroup model from which to retrieve the IFC schema.
|
|
1101
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1102
|
+
* @returns The IFC schema associated with the given model.
|
|
1103
|
+
*/
|
|
1104
|
+
static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
|
|
1105
|
+
/**
|
|
1106
|
+
* Method to set properties data in the model.
|
|
1055
1107
|
*
|
|
1056
|
-
* @
|
|
1057
|
-
*
|
|
1108
|
+
* @param model - The FragmentsGroup model in which to set the properties.
|
|
1109
|
+
* @param dataToSave - An array of objects representing the properties to be saved.
|
|
1110
|
+
* Each object must have an 'expressID' property, which is the express ID of the entity in the model.
|
|
1111
|
+
* The rest of the properties will be set as the properties of the entity.
|
|
1058
1112
|
*
|
|
1059
|
-
* @
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1062
|
-
* const rawBuffer = await response.arrayBuffer();
|
|
1063
|
-
* const ifcBuffer = new Uint8Array(rawBuffer);
|
|
1064
|
-
* await ifcGeometryTiler.streamFromBuffer(ifcBuffer);
|
|
1065
|
-
* '''
|
|
1113
|
+
* @returns {Promise<void>} A promise that resolves when all the properties have been set.
|
|
1114
|
+
*
|
|
1115
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
|
|
1066
1116
|
*/
|
|
1067
|
-
|
|
1117
|
+
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
1068
1118
|
/**
|
|
1069
|
-
*
|
|
1119
|
+
* Creates a new Property Set (Pset) in the given model.
|
|
1070
1120
|
*
|
|
1071
|
-
* @param
|
|
1072
|
-
* @
|
|
1121
|
+
* @param model - The FragmentsGroup model in which to create the Pset.
|
|
1122
|
+
* @param name - The name of the Pset.
|
|
1123
|
+
* @param description - (Optional) The description of the Pset.
|
|
1073
1124
|
*
|
|
1074
|
-
* @
|
|
1075
|
-
* This method cleans up any resources after the streaming process is complete.
|
|
1125
|
+
* @returns A promise that resolves with an object containing the newly created Pset and its relation.
|
|
1076
1126
|
*
|
|
1127
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1128
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1077
1129
|
*/
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
private cleanUp;
|
|
1083
|
-
private getMesh;
|
|
1084
|
-
private getGeometry;
|
|
1085
|
-
private streamAssets;
|
|
1086
|
-
private streamGeometries;
|
|
1087
|
-
}
|
|
1088
|
-
import * as THREE from "three";
|
|
1089
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1090
|
-
import { Component, Components } from "../../core";
|
|
1091
|
-
/**
|
|
1092
|
-
* Represents an edge measurement result.
|
|
1093
|
-
*/
|
|
1094
|
-
export interface MeasureEdge {
|
|
1095
|
-
/**
|
|
1096
|
-
* The distance between the two points of the edge.
|
|
1097
|
-
*/
|
|
1098
|
-
distance: number;
|
|
1130
|
+
newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
|
|
1131
|
+
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
1132
|
+
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
1133
|
+
}>;
|
|
1099
1134
|
/**
|
|
1100
|
-
*
|
|
1135
|
+
* Removes a Property Set (Pset) from the given model.
|
|
1136
|
+
*
|
|
1137
|
+
* @param model - The FragmentsGroup model from which to remove the Pset.
|
|
1138
|
+
* @param psetID - The express IDs of the Psets to be removed.
|
|
1139
|
+
*
|
|
1140
|
+
* @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
|
|
1141
|
+
*
|
|
1142
|
+
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
|
|
1143
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1144
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1101
1145
|
*/
|
|
1102
|
-
|
|
1103
|
-
}
|
|
1104
|
-
/**
|
|
1105
|
-
* Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
|
|
1106
|
-
*/
|
|
1107
|
-
export declare class MeasurementUtils extends Component {
|
|
1146
|
+
removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
|
|
1108
1147
|
/**
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1148
|
+
* Creates a new single-value property of type string in the given model.
|
|
1149
|
+
*
|
|
1150
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1151
|
+
* @param type - The type of the property value. Must be a string property type.
|
|
1152
|
+
* @param name - The name of the property.
|
|
1153
|
+
* @param value - The value of the property. Must be a string.
|
|
1154
|
+
*
|
|
1155
|
+
* @returns The newly created single-value property.
|
|
1156
|
+
*
|
|
1157
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1158
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1111
1159
|
*/
|
|
1112
|
-
|
|
1113
|
-
/** {@link Component.enabled} */
|
|
1114
|
-
enabled: boolean;
|
|
1115
|
-
constructor(components: Components);
|
|
1160
|
+
newSingleStringProperty(model: FragmentsGroup, type: StringPropTypes, name: string, value: string): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1116
1161
|
/**
|
|
1117
|
-
*
|
|
1162
|
+
* Creates a new single-value property of type numeric in the given model.
|
|
1118
1163
|
*
|
|
1119
|
-
* @param
|
|
1120
|
-
* @param
|
|
1121
|
-
* @param
|
|
1122
|
-
* @param
|
|
1123
|
-
*
|
|
1164
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1165
|
+
* @param type - The type of the property value. Must be a numeric property type.
|
|
1166
|
+
* @param name - The name of the property.
|
|
1167
|
+
* @param value - The value of the property. Must be a number.
|
|
1168
|
+
*
|
|
1169
|
+
* @returns The newly created single-value property.
|
|
1170
|
+
*
|
|
1171
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1172
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1124
1173
|
*/
|
|
1125
|
-
|
|
1174
|
+
newSingleNumericProperty(model: FragmentsGroup, type: NumericPropTypes, name: string, value: number): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1126
1175
|
/**
|
|
1127
|
-
*
|
|
1128
|
-
* It also returns the edges of the found face and their indices.
|
|
1176
|
+
* Creates a new single-value property of type boolean in the given model.
|
|
1129
1177
|
*
|
|
1130
|
-
* @param
|
|
1131
|
-
* @param
|
|
1132
|
-
* @param
|
|
1133
|
-
* @
|
|
1178
|
+
* @param model - The FragmentsGroup model in which to create the property.
|
|
1179
|
+
* @param type - The type of the property value. Must be a boolean property type.
|
|
1180
|
+
* @param name - The name of the property.
|
|
1181
|
+
* @param value - The value of the property. Must be a boolean.
|
|
1182
|
+
*
|
|
1183
|
+
* @returns The newly created single-value property.
|
|
1184
|
+
*
|
|
1185
|
+
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1186
|
+
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1134
1187
|
*/
|
|
1135
|
-
|
|
1136
|
-
edges: MeasureEdge[];
|
|
1137
|
-
indices: Set<number>;
|
|
1138
|
-
} | null;
|
|
1188
|
+
newSingleBooleanProperty(model: FragmentsGroup, type: BooleanPropTypes, name: string, value: boolean): Promise<WEBIFC.IFC2X3.IfcPropertySingleValue | WEBIFC.IFC4.IfcPropertySingleValue | WEBIFC.IFC4X3.IfcPropertySingleValue>;
|
|
1139
1189
|
/**
|
|
1140
|
-
*
|
|
1141
|
-
* It also applies instance transformation if provided.
|
|
1190
|
+
* Removes a property from a Property Set (Pset) in the given model.
|
|
1142
1191
|
*
|
|
1143
|
-
* @param
|
|
1144
|
-
* @param
|
|
1145
|
-
* @param
|
|
1146
|
-
*
|
|
1147
|
-
* @
|
|
1192
|
+
* @param model - The FragmentsGroup model from which to remove the property.
|
|
1193
|
+
* @param psetID - The express ID of the Pset from which to remove the property.
|
|
1194
|
+
* @param propID - The express ID of the property to be removed.
|
|
1195
|
+
*
|
|
1196
|
+
* @returns {Promise<void>} A promise that resolves when the property has been removed.
|
|
1197
|
+
*
|
|
1198
|
+
* @throws Will throw an error if the Pset or the property to be removed are not found in the model.
|
|
1199
|
+
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1148
1200
|
*/
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
p2: THREE.Vector3;
|
|
1152
|
-
p3: THREE.Vector3;
|
|
1153
|
-
faceNormal: THREE.Vector3;
|
|
1154
|
-
};
|
|
1201
|
+
removePsetProp(model: FragmentsGroup, psetID: number, propID: number): Promise<void>;
|
|
1202
|
+
addElementToPset(model: FragmentsGroup, psetID: number, ...elementID: number[]): Promise<void>;
|
|
1155
1203
|
/**
|
|
1156
|
-
*
|
|
1157
|
-
* This is used to ensure numerical precision in edge detection.
|
|
1204
|
+
* Adds elements to a Property Set (Pset) in the given model.
|
|
1158
1205
|
*
|
|
1159
|
-
* @param
|
|
1160
|
-
* @
|
|
1206
|
+
* @param model - The FragmentsGroup model in which to add the elements.
|
|
1207
|
+
* @param psetID - The express ID of the Pset to which to add the elements.
|
|
1208
|
+
* @param elementID - The express IDs of the elements to be added.
|
|
1209
|
+
*
|
|
1210
|
+
* @returns {Promise<void>} A promise that resolves when all the elements have been added.
|
|
1211
|
+
*
|
|
1212
|
+
* @throws Will throw an error if the Pset or the elements to be added are not found in the model.
|
|
1213
|
+
* @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
|
|
1214
|
+
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1161
1215
|
*/
|
|
1162
|
-
|
|
1216
|
+
addPropToPset(model: FragmentsGroup, psetID: number, ...propID: number[]): Promise<void>;
|
|
1163
1217
|
/**
|
|
1164
|
-
*
|
|
1218
|
+
* Saves the changes made to the model to a new IFC file.
|
|
1165
1219
|
*
|
|
1166
|
-
* @param
|
|
1167
|
-
* @
|
|
1220
|
+
* @param model - The FragmentsGroup model from which to save the changes.
|
|
1221
|
+
* @param ifcToSaveOn - The Uint8Array representing the original IFC file.
|
|
1168
1222
|
*
|
|
1169
|
-
* @
|
|
1170
|
-
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
1171
|
-
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
1223
|
+
* @returns A promise that resolves with the modified IFC data as a Uint8Array.
|
|
1172
1224
|
*
|
|
1173
|
-
* @throws Will throw an error if
|
|
1174
|
-
* @throws Will throw an error if the fragment manager is not available.
|
|
1225
|
+
* @throws Will throw an error if any issues occur during the saving process.
|
|
1175
1226
|
*/
|
|
1176
|
-
|
|
1227
|
+
saveToIfc(model: FragmentsGroup, ifcToSaveOn: Uint8Array): Promise<Uint8Array>;
|
|
1177
1228
|
/**
|
|
1178
|
-
*
|
|
1229
|
+
* Sets an attribute listener for a specific attribute of an entity in the model.
|
|
1230
|
+
* The listener will trigger an event whenever the attribute's value changes.
|
|
1179
1231
|
*
|
|
1180
|
-
* @param
|
|
1181
|
-
* @
|
|
1232
|
+
* @param model - The FragmentsGroup model in which to set the attribute listener.
|
|
1233
|
+
* @param expressID - The express ID of the entity for which to set the listener.
|
|
1234
|
+
* @param attributeName - The name of the attribute for which to set the listener.
|
|
1182
1235
|
*
|
|
1183
|
-
* @
|
|
1184
|
-
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
1185
|
-
* and its bounding sphere.
|
|
1236
|
+
* @returns The event that will be triggered when the attribute's value changes.
|
|
1186
1237
|
*
|
|
1238
|
+
* @throws Will throw an error if the entity with the given expressID doesn't exist.
|
|
1239
|
+
* @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
|
|
1240
|
+
* @throws Will throw an error if the attribute has a badly defined handle.
|
|
1187
1241
|
*/
|
|
1188
|
-
|
|
1189
|
-
private
|
|
1190
|
-
private
|
|
1191
|
-
private
|
|
1242
|
+
setAttributeListener(model: FragmentsGroup, expressID: number, attributeName: string): Promise<Event<String | Number | Boolean>>;
|
|
1243
|
+
private increaseMaxID;
|
|
1244
|
+
private newGUID;
|
|
1245
|
+
private getOwnerHistory;
|
|
1246
|
+
private registerChange;
|
|
1247
|
+
private newSingleProperty;
|
|
1192
1248
|
}
|
|
1193
1249
|
import * as WEBIFC from "web-ifc";
|
|
1194
|
-
import {
|
|
1195
|
-
import {
|
|
1250
|
+
import { FragmentsGroup } from "@thatopen/fragments";
|
|
1251
|
+
import { Disposable, Event, Component, Components } from "../../core";
|
|
1252
|
+
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
1253
|
+
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
1196
1254
|
/**
|
|
1197
|
-
*
|
|
1255
|
+
* 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).
|
|
1198
1256
|
*/
|
|
1199
|
-
export declare class
|
|
1257
|
+
export declare class IfcRelationsIndexer extends Component implements Disposable {
|
|
1200
1258
|
/**
|
|
1201
1259
|
* A unique identifier for the component.
|
|
1202
1260
|
* This UUID is used to register the component within the Components system.
|
|
1203
1261
|
*/
|
|
1204
|
-
static readonly uuid: "
|
|
1262
|
+
static readonly uuid: "23a889ab-83b3-44a4-8bee-ead83438370b";
|
|
1263
|
+
/** {@link Disposable.onDisposed} */
|
|
1264
|
+
readonly onDisposed: Event<string>;
|
|
1205
1265
|
/**
|
|
1206
|
-
*
|
|
1207
|
-
*
|
|
1266
|
+
* Event triggered when relations for a model have been indexed.
|
|
1267
|
+
* This event provides the model's UUID and the relations map generated for that model.
|
|
1268
|
+
*
|
|
1269
|
+
* @property {string} modelID - The UUID of the model for which relations have been indexed.
|
|
1270
|
+
* @property {RelationsMap} relationsMap - The relations map generated for the specified model.
|
|
1271
|
+
* 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.
|
|
1208
1272
|
*/
|
|
1209
|
-
readonly
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
[id: number]: any;
|
|
1213
|
-
};
|
|
1273
|
+
readonly onRelationsIndexed: Event<{
|
|
1274
|
+
modelID: string;
|
|
1275
|
+
relationsMap: RelationsMap;
|
|
1214
1276
|
}>;
|
|
1215
1277
|
/**
|
|
1216
|
-
*
|
|
1217
|
-
* The
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
*
|
|
1222
|
-
* The event provides a map of indices, where the key is the entity type and the value is another map of indices.
|
|
1278
|
+
* Holds the relationship mappings for each model processed by the indexer.
|
|
1279
|
+
* The structure is a map where each key is a model's UUID, and the value is another map.
|
|
1280
|
+
* This inner map's keys are entity expressIDs, and its values are maps where each key is an index
|
|
1281
|
+
* representing a specific relation type, and the value is an array of expressIDs of entities
|
|
1282
|
+
* that are related through that relation type. This structure allows for efficient querying
|
|
1283
|
+
* of entity relationships within a model.
|
|
1223
1284
|
*/
|
|
1224
|
-
readonly
|
|
1225
|
-
/** {@link Disposable.onDisposed} */
|
|
1226
|
-
readonly onDisposed: Event<string>;
|
|
1285
|
+
readonly relationMaps: ModelsRelationMap;
|
|
1227
1286
|
/** {@link Component.enabled} */
|
|
1228
1287
|
enabled: boolean;
|
|
1288
|
+
private _relToAttributesMap;
|
|
1289
|
+
private _inverseAttributes;
|
|
1290
|
+
private _ifcRels;
|
|
1291
|
+
constructor(components: Components);
|
|
1292
|
+
private onFragmentsDisposed;
|
|
1293
|
+
private indexRelations;
|
|
1229
1294
|
/**
|
|
1230
|
-
*
|
|
1295
|
+
* Adds a relation map to the model's relations map.
|
|
1296
|
+
*
|
|
1297
|
+
* @param model - The 'FragmentsGroup' model to which the relation map will be added.
|
|
1298
|
+
* @param relationMap - The 'RelationsMap' to be added to the model's relations map.
|
|
1299
|
+
*
|
|
1300
|
+
* @fires onRelationsIndexed - Triggers an event with the model's UUID and the added relation map.
|
|
1231
1301
|
*/
|
|
1232
|
-
|
|
1302
|
+
setRelationMap(model: FragmentsGroup, relationMap: RelationsMap): void;
|
|
1233
1303
|
/**
|
|
1234
|
-
*
|
|
1304
|
+
* Processes a given model to index its IFC entities relations based on predefined inverse attributes.
|
|
1305
|
+
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
1306
|
+
* and maps them in a structured way to facilitate quick access to related entities.
|
|
1307
|
+
*
|
|
1308
|
+
* The process involves querying the model for each relation type associated with the inverse attributes
|
|
1309
|
+
* and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
|
|
1310
|
+
* and contains a nested map where each key is an entity's expressID and its value is another map.
|
|
1311
|
+
* This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
|
|
1312
|
+
* of entities that are related through that attribute.
|
|
1313
|
+
*
|
|
1314
|
+
* @param model The 'FragmentsGroup' model to be processed. It must have properties loaded.
|
|
1315
|
+
* @returns A promise that resolves to the relations map for the processed model. This map is a detailed
|
|
1316
|
+
* representation of the relations indexed by entity expressIDs and relation types.
|
|
1317
|
+
* @throws An error if the model does not have properties loaded.
|
|
1235
1318
|
*/
|
|
1236
|
-
|
|
1237
|
-
/** {@link Disposable.dispose} */
|
|
1238
|
-
dispose(): Promise<void>;
|
|
1319
|
+
process(model: FragmentsGroup): Promise<RelationsMap>;
|
|
1239
1320
|
/**
|
|
1240
|
-
*
|
|
1321
|
+
* Processes a given model from a WebIfc API to index its IFC entities relations.
|
|
1241
1322
|
*
|
|
1242
|
-
* @param
|
|
1243
|
-
* @
|
|
1323
|
+
* @param ifcApi - The WebIfc API instance from which to retrieve the model's properties.
|
|
1324
|
+
* @param modelID - The unique identifier of the model within the WebIfc API.
|
|
1325
|
+
* @returns A promise that resolves to the relations map for the processed model.
|
|
1326
|
+
* This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
|
|
1244
1327
|
*/
|
|
1245
|
-
|
|
1328
|
+
processFromWebIfc(ifcApi: WEBIFC.IfcAPI, modelID: number): Promise<RelationsMap>;
|
|
1246
1329
|
/**
|
|
1247
|
-
*
|
|
1330
|
+
* Retrieves the relations of a specific entity within a model based on the given relation name.
|
|
1331
|
+
* This method searches the indexed relation maps for the specified model and entity,
|
|
1332
|
+
* returning the IDs of related entities if a match is found.
|
|
1248
1333
|
*
|
|
1249
|
-
* @param
|
|
1250
|
-
* @
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
private streamIfcFile;
|
|
1255
|
-
private streamAllProperties;
|
|
1256
|
-
private cleanUp;
|
|
1257
|
-
}
|
|
1258
|
-
import { Fragment, FragmentsGroup } from "@thatopen/fragments";
|
|
1259
|
-
import * as THREE from "three";
|
|
1260
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
1261
|
-
import { Component, Components, Event, Disposable } from "../../core";
|
|
1262
|
-
import { RelationsMap } from "../../ifc/IfcRelationsIndexer/src/types";
|
|
1263
|
-
/**
|
|
1264
|
-
* Component to load, delete and manage [fragments](https://github.com/ThatOpen/engine_fragment) efficiently. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/FragmentsManager). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/FragmentsManager).
|
|
1265
|
-
*/
|
|
1266
|
-
export declare class FragmentsManager extends Component implements Disposable {
|
|
1267
|
-
/**
|
|
1268
|
-
* A unique identifier for the component.
|
|
1269
|
-
* This UUID is used to register the component within the Components system.
|
|
1270
|
-
*/
|
|
1271
|
-
static readonly uuid: "fef46874-46a3-461b-8c44-2922ab77c806";
|
|
1272
|
-
/** {@link Disposable.onDisposed} */
|
|
1273
|
-
readonly onDisposed: Event<unknown>;
|
|
1274
|
-
/**
|
|
1275
|
-
* Event triggered when fragments are loaded.
|
|
1334
|
+
* @param model The 'FragmentsGroup' model containing the entity.
|
|
1335
|
+
* @param expressID The unique identifier of the entity within the model.
|
|
1336
|
+
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
1337
|
+
* @returns An array of express IDs representing the related entities, or 'null' if no relations are found
|
|
1338
|
+
* or the specified relation name is not indexed.
|
|
1276
1339
|
*/
|
|
1277
|
-
|
|
1340
|
+
getEntityRelations(model: FragmentsGroup, expressID: number, relationName: InverseAttribute): number[] | null;
|
|
1278
1341
|
/**
|
|
1279
|
-
*
|
|
1342
|
+
* Serializes the relations of a given relation map into a JSON string.
|
|
1343
|
+
* 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,
|
|
1344
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1345
|
+
* The resulting object is then serialized into a JSON string.
|
|
1346
|
+
*
|
|
1347
|
+
* @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.
|
|
1348
|
+
* @returns A JSON string representing the serialized relations of the given relation map.
|
|
1280
1349
|
*/
|
|
1281
|
-
|
|
1282
|
-
groupID: string;
|
|
1283
|
-
fragmentIDs: string[];
|
|
1284
|
-
}>;
|
|
1350
|
+
serializeRelations(relationMap: RelationsMap): string;
|
|
1285
1351
|
/**
|
|
1286
|
-
*
|
|
1287
|
-
*
|
|
1352
|
+
* Serializes the relations of a specific model into a JSON string.
|
|
1353
|
+
* This method iterates through the relations indexed for the given model,
|
|
1354
|
+
* organizing them into a structured object where each key is an expressID of an entity,
|
|
1355
|
+
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1356
|
+
* The resulting object is then serialized into a JSON string.
|
|
1357
|
+
*
|
|
1358
|
+
* @param model The 'FragmentsGroup' model whose relations are to be serialized.
|
|
1359
|
+
* @returns A JSON string representing the serialized relations of the specified model.
|
|
1360
|
+
* If the model has no indexed relations, 'null' is returned.
|
|
1288
1361
|
*/
|
|
1289
|
-
|
|
1362
|
+
serializeModelRelations(model: FragmentsGroup): string | null;
|
|
1290
1363
|
/**
|
|
1291
|
-
*
|
|
1292
|
-
*
|
|
1364
|
+
* Serializes all relations of every model processed by the indexer into a JSON string.
|
|
1365
|
+
* This method iterates through each model's relations indexed in 'relationMaps', organizing them
|
|
1366
|
+
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
1367
|
+
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
1368
|
+
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
1369
|
+
*
|
|
1370
|
+
* @returns A JSON string representing the serialized relations of all models processed by the indexer.
|
|
1371
|
+
* If no relations have been indexed, an empty object is returned as a JSON string.
|
|
1293
1372
|
*/
|
|
1294
|
-
|
|
1295
|
-
baseCoordinationModel: string;
|
|
1296
|
-
/** {@link Component.enabled} */
|
|
1297
|
-
enabled: boolean;
|
|
1298
|
-
private _loader;
|
|
1373
|
+
serializeAllRelations(): string;
|
|
1299
1374
|
/**
|
|
1300
|
-
*
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1375
|
+
* Converts a JSON string representing relations between entities into a structured map.
|
|
1376
|
+
* This method parses the JSON string to reconstruct the relations map that indexes
|
|
1377
|
+
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
1378
|
+
* and the values are maps where each key is a relation type ID and its value is an array
|
|
1379
|
+
* of express IDs of entities related through that relation type.
|
|
1380
|
+
*
|
|
1381
|
+
* @param json The JSON string to be parsed into the relations map.
|
|
1382
|
+
* @returns A 'Map' where the key is the express ID of an entity as a number, and the value
|
|
1383
|
+
* is another 'Map'. This inner map's key is the relation type ID as a number, and its value
|
|
1384
|
+
* is an array of express IDs (as numbers) of entities related through that relation type.
|
|
1303
1385
|
*/
|
|
1304
|
-
|
|
1305
|
-
constructor(components: Components);
|
|
1386
|
+
getRelationsMapFromJSON(json: string): RelationsMap;
|
|
1306
1387
|
/** {@link Disposable.dispose} */
|
|
1307
1388
|
dispose(): void;
|
|
1308
1389
|
/**
|
|
1309
|
-
*
|
|
1310
|
-
* This method removes the group from the groups map, deletes all fragments within the group from the list,
|
|
1311
|
-
* disposes of the group, and triggers the onFragmentsDisposed event.
|
|
1312
|
-
*
|
|
1313
|
-
* @param group - The fragment group to be disposed.
|
|
1314
|
-
*/
|
|
1315
|
-
disposeGroup(group: FragmentsGroup): void;
|
|
1316
|
-
/**
|
|
1317
|
-
* Loads a binary file that contain fragment geometry.
|
|
1318
|
-
* @param data - The binary data to load.
|
|
1319
|
-
* @param config - Optional configuration for loading.
|
|
1320
|
-
* @param config.coordinate - Whether to apply coordinate transformation. Default is true.
|
|
1321
|
-
* @param config.properties - Ifc properties to set on the loaded fragments. Not to be used when streaming.
|
|
1322
|
-
* @returns The loaded FragmentsGroup.
|
|
1323
|
-
*/
|
|
1324
|
-
load(data: Uint8Array, config?: Partial<{
|
|
1325
|
-
coordinate: boolean;
|
|
1326
|
-
name: string;
|
|
1327
|
-
properties: FRAGS.IfcProperties;
|
|
1328
|
-
relationsMap: RelationsMap;
|
|
1329
|
-
}>): FragmentsGroup;
|
|
1330
|
-
/**
|
|
1331
|
-
* Export the specified fragmentsgroup to binary data.
|
|
1332
|
-
* @param group - the fragments group to be exported.
|
|
1333
|
-
* @returns the exported data as binary buffer.
|
|
1334
|
-
*/
|
|
1335
|
-
export(group: FragmentsGroup): Uint8Array;
|
|
1336
|
-
/**
|
|
1337
|
-
* Gets a map of model IDs to sets of express IDs for the given fragment ID map.
|
|
1338
|
-
* @param fragmentIdMap - A map of fragment IDs to their corresponding express IDs.
|
|
1339
|
-
* @returns A map of model IDs to sets of express IDs.
|
|
1340
|
-
*/
|
|
1341
|
-
getModelIdMap(fragmentIdMap: FRAGS.FragmentIdMap): {
|
|
1342
|
-
[modelID: string]: Set<number>;
|
|
1343
|
-
};
|
|
1344
|
-
/**
|
|
1345
|
-
* Converts a map of model IDs to sets of express IDs to a fragment ID map.
|
|
1346
|
-
* @param modelIdMap - A map of model IDs to their corresponding express IDs.
|
|
1347
|
-
* @returns A fragment ID map.
|
|
1348
|
-
* @remarks
|
|
1349
|
-
* This method iterates through the provided model ID map, retrieves the corresponding model from the 'groups' map,
|
|
1350
|
-
* and then calls the 'getFragmentMap' method of the model to obtain a fragment ID map for the given express IDs.
|
|
1351
|
-
* The fragment ID maps are then merged into a single map and returned.
|
|
1352
|
-
* If a model with a given ID is not found in the 'groups' map, the method skips that model and continues with the next one.
|
|
1353
|
-
*/
|
|
1354
|
-
modelIdToFragmentIdMap(modelIdMap: {
|
|
1355
|
-
[modelID: string]: Set<number>;
|
|
1356
|
-
}): FRAGS.FragmentIdMap;
|
|
1357
|
-
/**
|
|
1358
|
-
* Applies coordinate transformation to the provided models.
|
|
1359
|
-
* If no models are provided, all groups are used.
|
|
1360
|
-
* The first model in the list becomes the base model for coordinate transformation.
|
|
1361
|
-
* All other models are then transformed to match the base model's coordinate system.
|
|
1390
|
+
* Gets the children of the given element recursively. E.g. in a model with project - site - building - storeys - rooms, passing a storey will include all its children and the children of the rooms contained in it.
|
|
1362
1391
|
*
|
|
1363
|
-
* @param
|
|
1364
|
-
*
|
|
1392
|
+
* @param model The BIM model whose children to get.
|
|
1393
|
+
* @param id The expressID of the item whose children to get.
|
|
1394
|
+
* @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
|
|
1365
1395
|
*
|
|
1366
|
-
* @returns
|
|
1396
|
+
* @returns A 'Set' with the expressIDs of the found items.
|
|
1367
1397
|
*/
|
|
1368
|
-
|
|
1398
|
+
getElementsChildren(model: FragmentsGroup, id: number, found?: Set<number>): Set<number>;
|
|
1369
1399
|
}
|
|
1370
1400
|
import * as THREE from "three";
|
|
1371
1401
|
import * as FRAGS from "@thatopen/fragments";
|
|
1372
|
-
import {
|
|
1402
|
+
import { Component, Components } from "../../core";
|
|
1373
1403
|
/**
|
|
1374
|
-
*
|
|
1404
|
+
* Represents an edge measurement result.
|
|
1375
1405
|
*/
|
|
1376
|
-
export interface
|
|
1406
|
+
export interface MeasureEdge {
|
|
1377
1407
|
/**
|
|
1378
|
-
*
|
|
1379
|
-
* The key is the system name, and the value is an object representing the classes within the system.
|
|
1408
|
+
* The distance between the two points of the edge.
|
|
1380
1409
|
*/
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
[className: string]: FRAGS.FragmentIdMap;
|
|
1387
|
-
};
|
|
1410
|
+
distance: number;
|
|
1411
|
+
/**
|
|
1412
|
+
* The two points that define the edge.
|
|
1413
|
+
*/
|
|
1414
|
+
points: THREE.Vector3[];
|
|
1388
1415
|
}
|
|
1389
1416
|
/**
|
|
1390
|
-
*
|
|
1417
|
+
* Utility component for performing measurements on 3D meshes by providing methods for measuring distances between edges and faces. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MeasurementUtils). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MeasurementUtils).
|
|
1391
1418
|
*/
|
|
1392
|
-
export declare class
|
|
1419
|
+
export declare class MeasurementUtils extends Component {
|
|
1393
1420
|
/**
|
|
1394
1421
|
* A unique identifier for the component.
|
|
1395
1422
|
* This UUID is used to register the component within the Components system.
|
|
1396
1423
|
*/
|
|
1397
|
-
static
|
|
1424
|
+
static uuid: string;
|
|
1398
1425
|
/** {@link Component.enabled} */
|
|
1399
1426
|
enabled: boolean;
|
|
1400
|
-
/**
|
|
1401
|
-
* A map representing the classification systems.
|
|
1402
|
-
* The key is the system name, and the value is an object representing the classes within the system.
|
|
1403
|
-
*/
|
|
1404
|
-
list: Classification;
|
|
1405
|
-
/** {@link Disposable.onDisposed} */
|
|
1406
|
-
readonly onDisposed: Event<unknown>;
|
|
1407
1427
|
constructor(components: Components);
|
|
1408
|
-
private onFragmentsDisposed;
|
|
1409
|
-
/** {@link Disposable.dispose} */
|
|
1410
|
-
dispose(): void;
|
|
1411
1428
|
/**
|
|
1412
|
-
*
|
|
1413
|
-
* This method iterates through all classification systems and classes, and deletes the fragment with the specified guid from the respective group.
|
|
1429
|
+
* Utility method to calculate the distance from a point to a line segment.
|
|
1414
1430
|
*
|
|
1415
|
-
* @param
|
|
1431
|
+
* @param point - The point from which to calculate the distance.
|
|
1432
|
+
* @param lineStart - The start point of the line segment.
|
|
1433
|
+
* @param lineEnd - The end point of the line segment.
|
|
1434
|
+
* @param clamp - If true, the distance will be clamped to the line segment's length.
|
|
1435
|
+
* @returns The distance from the point to the line segment.
|
|
1416
1436
|
*/
|
|
1417
|
-
|
|
1437
|
+
static distanceFromPointToLine(point: THREE.Vector3, lineStart: THREE.Vector3, lineEnd: THREE.Vector3, clamp?: boolean): number;
|
|
1418
1438
|
/**
|
|
1419
|
-
*
|
|
1420
|
-
*
|
|
1439
|
+
* Method to get the face of a mesh that contains a given triangle index.
|
|
1440
|
+
* It also returns the edges of the found face and their indices.
|
|
1421
1441
|
*
|
|
1422
|
-
* @param
|
|
1423
|
-
* The
|
|
1424
|
-
*
|
|
1442
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1443
|
+
* @param triangleIndex - The index of the triangle within the mesh.
|
|
1444
|
+
* @param instance - The instance of the mesh (optional).
|
|
1445
|
+
* @returns An object containing the edges of the found face and their indices, or null if no face was found.
|
|
1446
|
+
*/
|
|
1447
|
+
getFace(mesh: THREE.InstancedMesh | THREE.Mesh, triangleIndex: number, instance?: number): {
|
|
1448
|
+
edges: MeasureEdge[];
|
|
1449
|
+
indices: Set<number>;
|
|
1450
|
+
} | null;
|
|
1451
|
+
/**
|
|
1452
|
+
* Method to get the vertices and normal of a mesh face at a given index.
|
|
1453
|
+
* It also applies instance transformation if provided.
|
|
1425
1454
|
*
|
|
1426
|
-
* @
|
|
1427
|
-
*
|
|
1455
|
+
* @param mesh - The mesh to get the face from. It must be indexed.
|
|
1456
|
+
* @param faceIndex - The index of the face within the mesh.
|
|
1457
|
+
* @param instance - The instance of the mesh (optional).
|
|
1458
|
+
* @returns An object containing the vertices and normal of the face.
|
|
1459
|
+
* @throws Will throw an error if the geometry is not indexed.
|
|
1460
|
+
*/
|
|
1461
|
+
getVerticesAndNormal(mesh: THREE.Mesh | THREE.InstancedMesh, faceIndex: number, instance: number | undefined): {
|
|
1462
|
+
p1: THREE.Vector3;
|
|
1463
|
+
p2: THREE.Vector3;
|
|
1464
|
+
p3: THREE.Vector3;
|
|
1465
|
+
faceNormal: THREE.Vector3;
|
|
1466
|
+
};
|
|
1467
|
+
/**
|
|
1468
|
+
* Method to round the vector's components to a specified number of decimal places.
|
|
1469
|
+
* This is used to ensure numerical precision in edge detection.
|
|
1428
1470
|
*
|
|
1429
|
-
* @
|
|
1471
|
+
* @param vector - The vector to round.
|
|
1472
|
+
* @returns The vector with rounded components.
|
|
1430
1473
|
*/
|
|
1431
|
-
|
|
1432
|
-
[name: string]: string[];
|
|
1433
|
-
}): FRAGS.FragmentIdMap;
|
|
1474
|
+
round(vector: THREE.Vector3): void;
|
|
1434
1475
|
/**
|
|
1435
|
-
*
|
|
1476
|
+
* Calculates the volume of a set of fragments.
|
|
1436
1477
|
*
|
|
1437
|
-
* @param
|
|
1438
|
-
* @
|
|
1478
|
+
* @param frags - A map of fragment IDs to their corresponding item IDs.
|
|
1479
|
+
* @returns The total volume of the fragments and the bounding sphere.
|
|
1439
1480
|
*
|
|
1440
1481
|
* @remarks
|
|
1441
|
-
* This method
|
|
1442
|
-
* and
|
|
1443
|
-
* The classification is stored in the 'list.models' property,
|
|
1444
|
-
* with the modelID as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1482
|
+
* This method creates a set of instanced meshes from the given fragments and item IDs.
|
|
1483
|
+
* It then calculates the volume of each mesh and returns the total volume and its bounding sphere.
|
|
1445
1484
|
*
|
|
1485
|
+
* @throws Will throw an error if the geometry of the meshes is not indexed.
|
|
1486
|
+
* @throws Will throw an error if the fragment manager is not available.
|
|
1446
1487
|
*/
|
|
1447
|
-
|
|
1488
|
+
getVolumeFromFragments(frags: FRAGS.FragmentIdMap): number;
|
|
1448
1489
|
/**
|
|
1449
|
-
*
|
|
1490
|
+
* Calculates the total volume of a set of meshes.
|
|
1450
1491
|
*
|
|
1451
|
-
* @param
|
|
1492
|
+
* @param meshes - An array of meshes or instanced meshes to calculate the volume from.
|
|
1493
|
+
* @returns The total volume of the meshes and the bounding sphere.
|
|
1452
1494
|
*
|
|
1453
1495
|
* @remarks
|
|
1454
|
-
* This method
|
|
1455
|
-
* and
|
|
1456
|
-
* The classification is stored in the 'list.predefinedTypes' property,
|
|
1457
|
-
* with the PredefinedType as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1496
|
+
* This method calculates the volume of each mesh in the provided array and returns the total volume
|
|
1497
|
+
* and its bounding sphere.
|
|
1458
1498
|
*
|
|
1459
|
-
* @throws Will throw an error if the fragment ID is not found.
|
|
1460
1499
|
*/
|
|
1461
|
-
|
|
1500
|
+
getVolumeFromMeshes(meshes: THREE.InstancedMesh[] | THREE.Mesh[]): number;
|
|
1501
|
+
private getFaceData;
|
|
1502
|
+
private getVolumeOfMesh;
|
|
1503
|
+
private getSignedVolumeOfTriangle;
|
|
1504
|
+
}
|
|
1505
|
+
import * as THREE from "three";
|
|
1506
|
+
import { Components } from "../Components";
|
|
1507
|
+
import { Component } from "../Types";
|
|
1508
|
+
/**
|
|
1509
|
+
* A tool to safely remove meshes, geometries, materials and other items from memory to [prevent memory leaks](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
1510
|
+
*/
|
|
1511
|
+
export declare class Disposer extends Component {
|
|
1512
|
+
private _disposedComponents;
|
|
1513
|
+
/** {@link Component.enabled} */
|
|
1514
|
+
enabled: boolean;
|
|
1462
1515
|
/**
|
|
1463
|
-
*
|
|
1516
|
+
* A unique identifier for the component.
|
|
1517
|
+
* This UUID is used to register the component within the Components system.
|
|
1518
|
+
*/
|
|
1519
|
+
static readonly uuid: "76e9cd8e-ad8f-4753-9ef6-cbc60f7247fe";
|
|
1520
|
+
constructor(components: Components);
|
|
1521
|
+
/**
|
|
1522
|
+
* Return the UUIDs of all disposed components.
|
|
1523
|
+
*/
|
|
1524
|
+
get(): Set<string>;
|
|
1525
|
+
/**
|
|
1526
|
+
* Removes a mesh, its geometry and its materials from memory. If you are
|
|
1527
|
+
* using any of these in other parts of the application, make sure that you
|
|
1528
|
+
* remove them from the mesh before disposing it.
|
|
1464
1529
|
*
|
|
1465
|
-
* @param
|
|
1530
|
+
* @param object - the [object](https://threejs.org/docs/#api/en/core/Object3D)
|
|
1531
|
+
* to remove.
|
|
1466
1532
|
*
|
|
1467
|
-
* @
|
|
1468
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
1469
|
-
* and classifies them based on their entity type.
|
|
1470
|
-
* The classification is stored in the 'list.entities' property,
|
|
1471
|
-
* with the entity type as the key and a map of fragment IDs to their respective express IDs as the value.
|
|
1533
|
+
* @param materials - whether to dispose the materials of the mesh.
|
|
1472
1534
|
*
|
|
1473
|
-
* @
|
|
1535
|
+
* @param recursive - whether to recursively dispose the children of the mesh.
|
|
1474
1536
|
*/
|
|
1475
|
-
|
|
1537
|
+
destroy(object: THREE.Object3D, materials?: boolean, recursive?: boolean): void;
|
|
1476
1538
|
/**
|
|
1477
|
-
*
|
|
1478
|
-
*
|
|
1479
|
-
* @param group - The FragmentsGroup containing the fragments to be classified.
|
|
1480
|
-
* @param ifcRel - The IFC relationship number to classify fragments by.
|
|
1481
|
-
* @param systemName - The name of the classification system to store the classification.
|
|
1482
|
-
*
|
|
1483
|
-
* @remarks
|
|
1484
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
1485
|
-
* and classifies them based on the specified IFC relationship.
|
|
1486
|
-
* The classification is stored in the 'list' property under the specified system name,
|
|
1487
|
-
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
1539
|
+
* Disposes a geometry from memory.
|
|
1488
1540
|
*
|
|
1489
|
-
* @
|
|
1541
|
+
* @param geometry - the
|
|
1542
|
+
* [geometry](https://threejs.org/docs/#api/en/core/BufferGeometry)
|
|
1543
|
+
* to remove.
|
|
1490
1544
|
*/
|
|
1491
|
-
|
|
1545
|
+
disposeGeometry(geometry: THREE.BufferGeometry): void;
|
|
1546
|
+
private disposeGeometryAndMaterials;
|
|
1547
|
+
private disposeChildren;
|
|
1548
|
+
private static disposeMaterial;
|
|
1549
|
+
}
|
|
1550
|
+
import { Component, Disposable, Event } from "../Types";
|
|
1551
|
+
/**
|
|
1552
|
+
* The entry point of the Components library. It can create, delete and access all the components of the library globally, update all the updatable components automatically and dispose all the components, preventing memory leaks.
|
|
1553
|
+
*/
|
|
1554
|
+
export declare class Components implements Disposable {
|
|
1492
1555
|
/**
|
|
1493
|
-
*
|
|
1556
|
+
* The version of the @thatopen/components library.
|
|
1557
|
+
*/
|
|
1558
|
+
static readonly release = "2.1.2";
|
|
1559
|
+
/** {@link Disposable.onDisposed} */
|
|
1560
|
+
readonly onDisposed: Event<void>;
|
|
1561
|
+
/**
|
|
1562
|
+
* The list of components created in this app.
|
|
1563
|
+
* The keys are UUIDs and the values are instances of the components.
|
|
1564
|
+
*/
|
|
1565
|
+
readonly list: Map<string, Component>;
|
|
1566
|
+
/**
|
|
1567
|
+
* If disabled, the animation loop will be stopped.
|
|
1568
|
+
* Default value is false.
|
|
1569
|
+
*/
|
|
1570
|
+
enabled: boolean;
|
|
1571
|
+
private _clock;
|
|
1572
|
+
/**
|
|
1573
|
+
* Adds a component to the list of components.
|
|
1574
|
+
* Throws an error if a component with the same UUID already exists.
|
|
1494
1575
|
*
|
|
1495
|
-
* @param
|
|
1576
|
+
* @param uuid - The unique identifier of the component.
|
|
1577
|
+
* @param instance - The instance of the component to be added.
|
|
1496
1578
|
*
|
|
1497
|
-
* @
|
|
1498
|
-
* This method iterates through the relations of the fragments in the provided group,
|
|
1499
|
-
* and classifies them based on their spatial structure in the IFC model.
|
|
1500
|
-
* The classification is stored in the 'list' property under the system name "spatialStructures",
|
|
1501
|
-
* with the relationship name as the class name and a map of fragment IDs to their respective express IDs as the value.
|
|
1579
|
+
* @throws Will throw an error if a component with the same UUID already exists.
|
|
1502
1580
|
*
|
|
1503
|
-
* @
|
|
1581
|
+
* @internal
|
|
1504
1582
|
*/
|
|
1505
|
-
|
|
1583
|
+
add(uuid: string, instance: Component): void;
|
|
1506
1584
|
/**
|
|
1507
|
-
*
|
|
1585
|
+
* Retrieves a component instance by its constructor function.
|
|
1586
|
+
* If the component does not exist in the list, it will be created and added.
|
|
1508
1587
|
*
|
|
1509
|
-
* @
|
|
1510
|
-
* @param
|
|
1511
|
-
* @param override - A boolean indicating whether to override the existing color of the fragments.
|
|
1588
|
+
* @template U - The type of the component to retrieve.
|
|
1589
|
+
* @param Component - The constructor function of the component to retrieve.
|
|
1512
1590
|
*
|
|
1513
|
-
* @
|
|
1514
|
-
* This method iterates through the provided fragment IDs, retrieves the corresponding fragments,
|
|
1515
|
-
* and sets their color using the 'setColor' method of the FragmentsGroup class.
|
|
1591
|
+
* @returns The instance of the requested component.
|
|
1516
1592
|
*
|
|
1517
|
-
* @throws Will throw an error if
|
|
1593
|
+
* @throws Will throw an error if a component with the same UUID already exists.
|
|
1594
|
+
*
|
|
1595
|
+
* @internal
|
|
1518
1596
|
*/
|
|
1519
|
-
|
|
1597
|
+
get<U extends Component>(Component: new (components: Components) => U): U;
|
|
1598
|
+
constructor();
|
|
1520
1599
|
/**
|
|
1521
|
-
*
|
|
1600
|
+
* Initializes the Components instance.
|
|
1601
|
+
* This method starts the animation loop, sets the enabled flag to true,
|
|
1602
|
+
* and calls the update method.
|
|
1522
1603
|
*
|
|
1523
|
-
* @
|
|
1604
|
+
* @returns {void}
|
|
1605
|
+
*/
|
|
1606
|
+
init(): void;
|
|
1607
|
+
/**
|
|
1608
|
+
* Disposes the memory of all the components and tools of this instance of
|
|
1609
|
+
* the library. A memory leak will be created if:
|
|
1524
1610
|
*
|
|
1525
|
-
*
|
|
1526
|
-
* This
|
|
1527
|
-
*
|
|
1611
|
+
* - An instance of the library ends up out of scope and this function isn't
|
|
1612
|
+
* called. This is especially relevant in Single Page Applications (React,
|
|
1613
|
+
* Angular, Vue, etc).
|
|
1614
|
+
*
|
|
1615
|
+
* - Any of the objects of this instance (meshes, geometries,materials, etc) is
|
|
1616
|
+
* referenced by a reference type (object or array).
|
|
1617
|
+
*
|
|
1618
|
+
* You can learn more about how Three.js handles memory leaks
|
|
1619
|
+
* [here](https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects).
|
|
1528
1620
|
*
|
|
1529
|
-
* @throws Will throw an error if the fragment with the specified ID is not found.
|
|
1530
1621
|
*/
|
|
1531
|
-
|
|
1532
|
-
|
|
1622
|
+
dispose(): void;
|
|
1623
|
+
private update;
|
|
1624
|
+
private static setupBVH;
|
|
1533
1625
|
}
|
|
1534
1626
|
import * as WEBIFC from "web-ifc";
|
|
1535
1627
|
import * as FRAG from "@thatopen/fragments";
|
|
@@ -1556,525 +1648,503 @@ export declare class IfcJsonExporter extends Component {
|
|
|
1556
1648
|
*/
|
|
1557
1649
|
export(webIfc: WEBIFC.IfcAPI, modelID: number, indirect?: boolean, recursiveSpatial?: boolean): Promise<FRAG.IfcProperties>;
|
|
1558
1650
|
}
|
|
1559
|
-
import
|
|
1560
|
-
import {
|
|
1561
|
-
import {
|
|
1562
|
-
import { RelationsMap, ModelsRelationMap, InverseAttribute } from "./src/types";
|
|
1563
|
-
export type { InverseAttribute, RelationsMap } from "./src/types";
|
|
1651
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
1652
|
+
import { SimpleRaycaster } from "./src";
|
|
1653
|
+
import { Components } from "../Components";
|
|
1564
1654
|
/**
|
|
1565
|
-
*
|
|
1655
|
+
* A component that manages a raycaster for each world and automatically disposes it when its corresponding world is disposed. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Raycasters). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Raycasters).
|
|
1566
1656
|
*/
|
|
1567
|
-
export declare class
|
|
1657
|
+
export declare class Raycasters extends Component implements Disposable {
|
|
1568
1658
|
/**
|
|
1569
1659
|
* A unique identifier for the component.
|
|
1570
1660
|
* This UUID is used to register the component within the Components system.
|
|
1571
1661
|
*/
|
|
1572
|
-
static readonly uuid: "
|
|
1662
|
+
static readonly uuid: "d5d8bdf0-db25-4952-b951-b643af207ace";
|
|
1663
|
+
/** {@link Component.enabled} */
|
|
1664
|
+
enabled: boolean;
|
|
1665
|
+
/**
|
|
1666
|
+
* A Map that stores raycasters for each world.
|
|
1667
|
+
* The key is the world's UUID, and the value is the corresponding SimpleRaycaster instance.
|
|
1668
|
+
*/
|
|
1669
|
+
list: Map<string, SimpleRaycaster>;
|
|
1573
1670
|
/** {@link Disposable.onDisposed} */
|
|
1574
|
-
|
|
1671
|
+
onDisposed: Event<unknown>;
|
|
1672
|
+
constructor(components: Components);
|
|
1575
1673
|
/**
|
|
1576
|
-
*
|
|
1577
|
-
*
|
|
1674
|
+
* Retrieves a SimpleRaycaster instance for the given world.
|
|
1675
|
+
* If a SimpleRaycaster instance already exists for the world, it will be returned.
|
|
1676
|
+
* Otherwise, a new SimpleRaycaster instance will be created and added to the list.
|
|
1578
1677
|
*
|
|
1579
|
-
* @
|
|
1580
|
-
* @
|
|
1581
|
-
* 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.
|
|
1678
|
+
* @param world - The world for which to retrieve or create a SimpleRaycaster instance.
|
|
1679
|
+
* @returns The SimpleRaycaster instance for the given world.
|
|
1582
1680
|
*/
|
|
1583
|
-
|
|
1584
|
-
modelID: string;
|
|
1585
|
-
relationsMap: RelationsMap;
|
|
1586
|
-
}>;
|
|
1681
|
+
get(world: World): SimpleRaycaster;
|
|
1587
1682
|
/**
|
|
1588
|
-
*
|
|
1589
|
-
*
|
|
1590
|
-
*
|
|
1591
|
-
*
|
|
1592
|
-
*
|
|
1593
|
-
* of entity relationships within a model.
|
|
1683
|
+
* Deletes the SimpleRaycaster instance associated with the given world.
|
|
1684
|
+
* If a SimpleRaycaster instance exists for the given world, it will be disposed and removed from the list.
|
|
1685
|
+
*
|
|
1686
|
+
* @param world - The world for which to delete the SimpleRaycaster instance.
|
|
1687
|
+
* @returns {void}
|
|
1594
1688
|
*/
|
|
1595
|
-
|
|
1689
|
+
delete(world: World): void;
|
|
1690
|
+
/** {@link Disposable.dispose} */
|
|
1691
|
+
dispose(): void;
|
|
1692
|
+
}
|
|
1693
|
+
import { Component, Disposable, Updateable, World, Event, BaseScene, BaseCamera, BaseRenderer } from "../Types";
|
|
1694
|
+
import { Components } from "../Components";
|
|
1695
|
+
import { SimpleWorld } from "./src";
|
|
1696
|
+
/**
|
|
1697
|
+
* A class representing a collection of worlds within a game engine. It manages the creation, deletion, and update of worlds. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Worlds). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Worlds).
|
|
1698
|
+
*/
|
|
1699
|
+
export declare class Worlds extends Component implements Updateable, Disposable {
|
|
1700
|
+
/**
|
|
1701
|
+
* A unique identifier for the component.
|
|
1702
|
+
* This UUID is used to register the component within the Components system.
|
|
1703
|
+
*/
|
|
1704
|
+
static readonly uuid: "fdb61dc4-2ec1-4966-b83d-54ea795fad4a";
|
|
1705
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
1706
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
1707
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
1708
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
1709
|
+
/** {@link Disposable.onDisposed} */
|
|
1710
|
+
readonly onDisposed: Event<unknown>;
|
|
1711
|
+
/**
|
|
1712
|
+
* An event that is triggered when a new world is created.
|
|
1713
|
+
* The event passes the newly created world as a parameter.
|
|
1714
|
+
*/
|
|
1715
|
+
readonly onWorldCreated: Event<World>;
|
|
1716
|
+
/**
|
|
1717
|
+
* An event that is triggered when a world is deleted.
|
|
1718
|
+
* The event passes the UUID of the deleted world as a parameter.
|
|
1719
|
+
*/
|
|
1720
|
+
readonly onWorldDeleted: Event<string>;
|
|
1721
|
+
/**
|
|
1722
|
+
* A collection of worlds managed by this component.
|
|
1723
|
+
* The key is the unique identifier (UUID) of the world, and the value is the World instance.
|
|
1724
|
+
*/
|
|
1725
|
+
list: Map<string, World>;
|
|
1596
1726
|
/** {@link Component.enabled} */
|
|
1597
1727
|
enabled: boolean;
|
|
1598
|
-
private _relToAttributesMap;
|
|
1599
|
-
private _inverseAttributes;
|
|
1600
|
-
private _ifcRels;
|
|
1601
1728
|
constructor(components: Components);
|
|
1602
|
-
private onFragmentsDisposed;
|
|
1603
|
-
private indexRelations;
|
|
1604
1729
|
/**
|
|
1605
|
-
*
|
|
1730
|
+
* Creates a new instance of a SimpleWorld and adds it to the list of worlds.
|
|
1606
1731
|
*
|
|
1607
|
-
* @
|
|
1608
|
-
* @
|
|
1732
|
+
* @template T - The type of the scene, extending from BaseScene. Defaults to BaseScene.
|
|
1733
|
+
* @template U - The type of the camera, extending from BaseCamera. Defaults to BaseCamera.
|
|
1734
|
+
* @template S - The type of the renderer, extending from BaseRenderer. Defaults to BaseRenderer.
|
|
1609
1735
|
*
|
|
1610
|
-
* @
|
|
1736
|
+
* @throws {Error} - Throws an error if a world with the same UUID already exists in the list.
|
|
1611
1737
|
*/
|
|
1612
|
-
|
|
1738
|
+
create<T extends BaseScene = BaseScene, U extends BaseCamera = BaseCamera, S extends BaseRenderer = BaseRenderer>(): SimpleWorld<T, U, S>;
|
|
1613
1739
|
/**
|
|
1614
|
-
*
|
|
1615
|
-
* This method iterates through each specified inverse attribute, retrieves the corresponding relations,
|
|
1616
|
-
* and maps them in a structured way to facilitate quick access to related entities.
|
|
1740
|
+
* Deletes a world from the list of worlds.
|
|
1617
1741
|
*
|
|
1618
|
-
*
|
|
1619
|
-
* and updating the internal relationMaps with the relationships found. This map is keyed by the model's UUID
|
|
1620
|
-
* and contains a nested map where each key is an entity's expressID and its value is another map.
|
|
1621
|
-
* This inner map's keys are the indices of the inverse attributes, and its values are arrays of expressIDs
|
|
1622
|
-
* of entities that are related through that attribute.
|
|
1742
|
+
* @param {World} world - The world to be deleted.
|
|
1623
1743
|
*
|
|
1624
|
-
* @
|
|
1625
|
-
*
|
|
1626
|
-
*
|
|
1627
|
-
* @throws An error if the model does not have properties loaded.
|
|
1744
|
+
* @throws {Error} - Throws an error if the provided world is not found in the list.
|
|
1745
|
+
*
|
|
1746
|
+
* @returns {void}
|
|
1628
1747
|
*/
|
|
1629
|
-
|
|
1748
|
+
delete(world: World): void;
|
|
1630
1749
|
/**
|
|
1631
|
-
*
|
|
1750
|
+
* Disposes of the Worlds component and all its managed worlds.
|
|
1751
|
+
* This method sets the enabled flag to false, disposes of all worlds, clears the list,
|
|
1752
|
+
* and triggers the onDisposed event.
|
|
1632
1753
|
*
|
|
1633
|
-
* @
|
|
1634
|
-
* @param modelID - The unique identifier of the model within the WebIfc API.
|
|
1635
|
-
* @returns A promise that resolves to the relations map for the processed model.
|
|
1636
|
-
* This map is a detailed representation of the relations indexed by entity expressIDs and relation types.
|
|
1754
|
+
* @returns {void}
|
|
1637
1755
|
*/
|
|
1638
|
-
|
|
1756
|
+
dispose(): void;
|
|
1757
|
+
/** {@link Updateable.update} */
|
|
1758
|
+
update(delta?: number): void | Promise<void>;
|
|
1759
|
+
}
|
|
1760
|
+
import { Component, Disposable, World, Event } from "../Types";
|
|
1761
|
+
import { GridConfig, SimpleGrid } from "./src";
|
|
1762
|
+
import { Components } from "../Components";
|
|
1763
|
+
/**
|
|
1764
|
+
* A component that manages grid instances. Each grid is associated with a unique world. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Grids). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Grids).
|
|
1765
|
+
*/
|
|
1766
|
+
export declare class Grids extends Component implements Disposable {
|
|
1639
1767
|
/**
|
|
1640
|
-
*
|
|
1641
|
-
* This
|
|
1642
|
-
* returning the IDs of related entities if a match is found.
|
|
1643
|
-
*
|
|
1644
|
-
* @param model The 'FragmentsGroup' model containing the entity.
|
|
1645
|
-
* @param expressID The unique identifier of the entity within the model.
|
|
1646
|
-
* @param relationName The IFC schema inverse attribute of the relation to search for (e.g., "IsDefinedBy", "ContainsElements").
|
|
1647
|
-
* @returns An array of express IDs representing the related entities, or 'null' if no relations are found
|
|
1648
|
-
* or the specified relation name is not indexed.
|
|
1768
|
+
* A unique identifier for the component.
|
|
1769
|
+
* This UUID is used to register the component within the Components system.
|
|
1649
1770
|
*/
|
|
1650
|
-
|
|
1771
|
+
static readonly uuid: "d1e814d5-b81c-4452-87a2-f039375e0489";
|
|
1651
1772
|
/**
|
|
1652
|
-
*
|
|
1653
|
-
* 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,
|
|
1654
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1655
|
-
* The resulting object is then serialized into a JSON string.
|
|
1656
|
-
*
|
|
1657
|
-
* @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.
|
|
1658
|
-
* @returns A JSON string representing the serialized relations of the given relation map.
|
|
1773
|
+
* A map of world UUIDs to their corresponding grid instances.
|
|
1659
1774
|
*/
|
|
1660
|
-
|
|
1775
|
+
list: Map<string, SimpleGrid>;
|
|
1661
1776
|
/**
|
|
1662
|
-
*
|
|
1663
|
-
* This method iterates through the relations indexed for the given model,
|
|
1664
|
-
* organizing them into a structured object where each key is an expressID of an entity,
|
|
1665
|
-
* and its value is another object mapping relation indices to arrays of related entity expressIDs.
|
|
1666
|
-
* The resulting object is then serialized into a JSON string.
|
|
1667
|
-
*
|
|
1668
|
-
* @param model The 'FragmentsGroup' model whose relations are to be serialized.
|
|
1669
|
-
* @returns A JSON string representing the serialized relations of the specified model.
|
|
1670
|
-
* If the model has no indexed relations, 'null' is returned.
|
|
1777
|
+
* The default configuration for grid creation.
|
|
1671
1778
|
*/
|
|
1672
|
-
|
|
1779
|
+
config: Required<GridConfig>;
|
|
1780
|
+
/** {@link Disposable.onDisposed} */
|
|
1781
|
+
readonly onDisposed: Event<unknown>;
|
|
1782
|
+
/** {@link Component.enabled} */
|
|
1783
|
+
enabled: boolean;
|
|
1784
|
+
constructor(components: Components);
|
|
1673
1785
|
/**
|
|
1674
|
-
*
|
|
1675
|
-
*
|
|
1676
|
-
* into a structured JSON object. Each top-level key in this object corresponds to a model's UUID,
|
|
1677
|
-
* and its value is another object mapping entity expressIDs to their related entities, categorized
|
|
1678
|
-
* by relation types. The structure facilitates easy access to any entity's relations across all models.
|
|
1786
|
+
* Creates a new grid for the given world.
|
|
1787
|
+
* Throws an error if a grid already exists for the world.
|
|
1679
1788
|
*
|
|
1680
|
-
* @
|
|
1681
|
-
*
|
|
1789
|
+
* @param world - The world to create the grid for.
|
|
1790
|
+
* @returns The newly created grid.
|
|
1791
|
+
*
|
|
1792
|
+
* @throws Will throw an error if a grid already exists for the given world.
|
|
1682
1793
|
*/
|
|
1683
|
-
|
|
1794
|
+
create(world: World): SimpleGrid;
|
|
1684
1795
|
/**
|
|
1685
|
-
*
|
|
1686
|
-
*
|
|
1687
|
-
* entity relations by their express IDs. The outer map keys are the express IDs of entities,
|
|
1688
|
-
* and the values are maps where each key is a relation type ID and its value is an array
|
|
1689
|
-
* of express IDs of entities related through that relation type.
|
|
1796
|
+
* Deletes the grid associated with the given world.
|
|
1797
|
+
* If a grid does not exist for the given world, this method does nothing.
|
|
1690
1798
|
*
|
|
1691
|
-
* @param
|
|
1692
|
-
*
|
|
1693
|
-
*
|
|
1694
|
-
*
|
|
1799
|
+
* @param world - The world for which to delete the grid.
|
|
1800
|
+
*
|
|
1801
|
+
* @remarks
|
|
1802
|
+
* This method will dispose of the grid and remove it from the internal list.
|
|
1803
|
+
* If the world is disposed before calling this method, the grid will be automatically deleted.
|
|
1695
1804
|
*/
|
|
1696
|
-
|
|
1805
|
+
delete(world: World): void;
|
|
1697
1806
|
/** {@link Disposable.dispose} */
|
|
1698
1807
|
dispose(): void;
|
|
1699
1808
|
}
|
|
1700
|
-
import * as
|
|
1701
|
-
import {
|
|
1702
|
-
import {
|
|
1703
|
-
|
|
1704
|
-
* Types for boolean properties in IFC schema.
|
|
1705
|
-
*/
|
|
1706
|
-
export type BooleanPropTypes = "IfcBoolean" | "IfcLogical";
|
|
1707
|
-
/**
|
|
1708
|
-
* Types for string properties in IFC schema.
|
|
1709
|
-
*/
|
|
1710
|
-
export type StringPropTypes = "IfcText" | "IfcLabel" | "IfcIdentifier";
|
|
1711
|
-
/**
|
|
1712
|
-
* Types for numeric properties in IFC schema.
|
|
1713
|
-
*/
|
|
1714
|
-
export type NumericPropTypes = "IfcInteger" | "IfcReal";
|
|
1715
|
-
/**
|
|
1716
|
-
* 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.
|
|
1717
|
-
*/
|
|
1718
|
-
export interface ChangeMap {
|
|
1719
|
-
[modelID: string]: Set<number>;
|
|
1720
|
-
}
|
|
1721
|
-
/**
|
|
1722
|
-
* 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.
|
|
1723
|
-
*/
|
|
1724
|
-
export interface AttributeListener {
|
|
1725
|
-
[modelID: string]: {
|
|
1726
|
-
[expressID: number]: {
|
|
1727
|
-
[attributeName: string]: Event<String | Boolean | Number>;
|
|
1728
|
-
};
|
|
1729
|
-
};
|
|
1730
|
-
}
|
|
1809
|
+
import * as THREE from "three";
|
|
1810
|
+
import { Component, Createable, Disposable, Event, Hideable, World } from "../Types";
|
|
1811
|
+
import { SimplePlane } from "./src";
|
|
1812
|
+
import { Components } from "../Components";
|
|
1731
1813
|
/**
|
|
1732
|
-
*
|
|
1814
|
+
* A lightweight component to easily create, delete and handle [clipping planes](https://threejs.org/docs/#api/en/materials/Material.clippingPlanes). 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Clipper). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Clipper).
|
|
1815
|
+
*
|
|
1816
|
+
* @param components - the instance of {@link Components} used.
|
|
1817
|
+
* E.g. {@link SimplePlane}.
|
|
1733
1818
|
*/
|
|
1734
|
-
export declare class
|
|
1819
|
+
export declare class Clipper extends Component implements Createable, Disposable, Hideable {
|
|
1735
1820
|
/**
|
|
1736
1821
|
* A unique identifier for the component.
|
|
1737
1822
|
* This UUID is used to register the component within the Components system.
|
|
1738
1823
|
*/
|
|
1739
|
-
static readonly uuid: "
|
|
1740
|
-
/**
|
|
1741
|
-
readonly
|
|
1824
|
+
static readonly uuid: "66290bc5-18c4-4cd1-9379-2e17a0617611";
|
|
1825
|
+
/** Event that fires when the user starts dragging a clipping plane. */
|
|
1826
|
+
readonly onBeforeDrag: Event<void>;
|
|
1827
|
+
/** Event that fires when the user stops dragging a clipping plane. */
|
|
1828
|
+
readonly onAfterDrag: Event<void>;
|
|
1742
1829
|
/**
|
|
1743
|
-
* Event
|
|
1830
|
+
* Event that fires when the user starts creating a clipping plane.
|
|
1744
1831
|
*/
|
|
1745
|
-
readonly
|
|
1832
|
+
readonly onBeforeCreate: Event<unknown>;
|
|
1746
1833
|
/**
|
|
1747
|
-
*
|
|
1834
|
+
* Event that fires when the user cancels the creation of a clipping plane.
|
|
1748
1835
|
*/
|
|
1749
|
-
|
|
1836
|
+
readonly onBeforeCancel: Event<unknown>;
|
|
1750
1837
|
/**
|
|
1751
|
-
* Event
|
|
1838
|
+
* Event that fires after the user cancels the creation of a clipping plane.
|
|
1752
1839
|
*/
|
|
1753
|
-
readonly
|
|
1754
|
-
model: FragmentsGroup;
|
|
1755
|
-
psetID: number;
|
|
1756
|
-
elementID: number;
|
|
1757
|
-
}>;
|
|
1840
|
+
readonly onAfterCancel: Event<unknown>;
|
|
1758
1841
|
/**
|
|
1759
|
-
* Event
|
|
1842
|
+
* Event that fires when the user starts deleting a clipping plane.
|
|
1760
1843
|
*/
|
|
1761
|
-
readonly
|
|
1762
|
-
model: FragmentsGroup;
|
|
1763
|
-
psetID: number;
|
|
1764
|
-
propID: number;
|
|
1765
|
-
}>;
|
|
1844
|
+
readonly onBeforeDelete: Event<unknown>;
|
|
1766
1845
|
/**
|
|
1767
|
-
* Event
|
|
1846
|
+
* Event that fires after a clipping plane has been created.
|
|
1847
|
+
* @param plane - The newly created clipping plane.
|
|
1768
1848
|
*/
|
|
1769
|
-
readonly
|
|
1770
|
-
model: FragmentsGroup;
|
|
1771
|
-
psetID: number;
|
|
1772
|
-
}>;
|
|
1849
|
+
readonly onAfterCreate: Event<SimplePlane>;
|
|
1773
1850
|
/**
|
|
1774
|
-
* Event
|
|
1851
|
+
* Event that fires after a clipping plane has been deleted.
|
|
1852
|
+
* @param plane - The deleted clipping plane.
|
|
1775
1853
|
*/
|
|
1776
|
-
readonly
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
}>;
|
|
1854
|
+
readonly onAfterDelete: Event<SimplePlane>;
|
|
1855
|
+
/** {@link Disposable.onDisposed} */
|
|
1856
|
+
readonly onDisposed: Event<string>;
|
|
1780
1857
|
/**
|
|
1781
|
-
*
|
|
1858
|
+
* Whether to force the clipping plane to be orthogonal in the Y direction
|
|
1859
|
+
* (up). This is desirable when clipping a building horizontally and a
|
|
1860
|
+
* clipping plane is created in its roof, which might have a slight
|
|
1861
|
+
* slope for draining purposes.
|
|
1782
1862
|
*/
|
|
1783
|
-
|
|
1784
|
-
path: string;
|
|
1785
|
-
absolute: boolean;
|
|
1786
|
-
};
|
|
1787
|
-
/** {@link Component.enabled} */
|
|
1788
|
-
enabled: boolean;
|
|
1863
|
+
orthogonalY: boolean;
|
|
1789
1864
|
/**
|
|
1790
|
-
*
|
|
1865
|
+
* The tolerance that determines whether an almost-horizontal clipping plane
|
|
1866
|
+
* will be forced to be orthogonal to the Y direction. {@link orthogonalY}
|
|
1867
|
+
* has to be 'true' for this to apply.
|
|
1791
1868
|
*/
|
|
1792
|
-
|
|
1869
|
+
toleranceOrthogonalY: number;
|
|
1793
1870
|
/**
|
|
1794
|
-
* The
|
|
1871
|
+
* The type of clipping plane to be created.
|
|
1872
|
+
* Default is {@link SimplePlane}.
|
|
1795
1873
|
*/
|
|
1796
|
-
|
|
1874
|
+
Type: new (...args: any) => SimplePlane;
|
|
1797
1875
|
/**
|
|
1798
|
-
*
|
|
1876
|
+
* A list of all the clipping planes created by this component.
|
|
1799
1877
|
*/
|
|
1800
|
-
|
|
1878
|
+
list: SimplePlane[];
|
|
1879
|
+
/** The material used in all the clipping planes. */
|
|
1880
|
+
private _material;
|
|
1881
|
+
private _size;
|
|
1882
|
+
private _enabled;
|
|
1883
|
+
private _visible;
|
|
1884
|
+
/** {@link Component.enabled} */
|
|
1885
|
+
get enabled(): boolean;
|
|
1886
|
+
/** {@link Component.enabled} */
|
|
1887
|
+
set enabled(state: boolean);
|
|
1888
|
+
/** {@link Hideable.visible } */
|
|
1889
|
+
get visible(): boolean;
|
|
1890
|
+
/** {@link Hideable.visible } */
|
|
1891
|
+
set visible(state: boolean);
|
|
1892
|
+
/** The material of the clipping plane representation. */
|
|
1893
|
+
get material(): THREE.MeshBasicMaterial;
|
|
1894
|
+
/** The material of the clipping plane representation. */
|
|
1895
|
+
set material(material: THREE.MeshBasicMaterial);
|
|
1896
|
+
/** The size of the geometric representation of the clippings planes. */
|
|
1897
|
+
get size(): number;
|
|
1898
|
+
/** The size of the geometric representation of the clippings planes. */
|
|
1899
|
+
set size(size: number);
|
|
1801
1900
|
constructor(components: Components);
|
|
1802
1901
|
/** {@link Disposable.dispose} */
|
|
1803
1902
|
dispose(): void;
|
|
1903
|
+
/** {@link Createable.create} */
|
|
1904
|
+
create(world: World): void;
|
|
1804
1905
|
/**
|
|
1805
|
-
*
|
|
1806
|
-
*
|
|
1807
|
-
* @param model - The FragmentsGroup model from which to retrieve the IFC schema.
|
|
1808
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1809
|
-
* @returns The IFC schema associated with the given model.
|
|
1810
|
-
*/
|
|
1811
|
-
static getIFCSchema(model: FragmentsGroup): import("@thatopen/fragments").IfcSchema;
|
|
1812
|
-
/**
|
|
1813
|
-
* Method to set properties data in the model.
|
|
1814
|
-
*
|
|
1815
|
-
* @param model - The FragmentsGroup model in which to set the properties.
|
|
1816
|
-
* @param dataToSave - An array of objects representing the properties to be saved.
|
|
1817
|
-
* Each object must have an 'expressID' property, which is the express ID of the entity in the model.
|
|
1818
|
-
* The rest of the properties will be set as the properties of the entity.
|
|
1819
|
-
*
|
|
1820
|
-
* @returns {Promise<void>} A promise that resolves when all the properties have been set.
|
|
1821
|
-
*
|
|
1822
|
-
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'dataToSave' array.
|
|
1823
|
-
*/
|
|
1824
|
-
setData(model: FragmentsGroup, ...dataToSave: Record<string, any>[]): Promise<void>;
|
|
1825
|
-
/**
|
|
1826
|
-
* Creates a new Property Set (Pset) in the given model.
|
|
1827
|
-
*
|
|
1828
|
-
* @param model - The FragmentsGroup model in which to create the Pset.
|
|
1829
|
-
* @param name - The name of the Pset.
|
|
1830
|
-
* @param description - (Optional) The description of the Pset.
|
|
1831
|
-
*
|
|
1832
|
-
* @returns A promise that resolves with an object containing the newly created Pset and its relation.
|
|
1833
|
-
*
|
|
1834
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1835
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1836
|
-
*/
|
|
1837
|
-
newPset(model: FragmentsGroup, name: string, description?: string): Promise<{
|
|
1838
|
-
pset: WEBIFC.IFC2X3.IfcPropertySet | WEBIFC.IFC4.IfcPropertySet | WEBIFC.IFC4X3.IfcPropertySet;
|
|
1839
|
-
rel: WEBIFC.IFC4X3.IfcRelDefinesByProperties | WEBIFC.IFC4.IfcRelDefinesByProperties | WEBIFC.IFC2X3.IfcRelDefinesByProperties;
|
|
1840
|
-
}>;
|
|
1841
|
-
/**
|
|
1842
|
-
* Removes a Property Set (Pset) from the given model.
|
|
1843
|
-
*
|
|
1844
|
-
* @param model - The FragmentsGroup model from which to remove the Pset.
|
|
1845
|
-
* @param psetID - The express IDs of the Psets to be removed.
|
|
1846
|
-
*
|
|
1847
|
-
* @returns {Promise<void>} A promise that resolves when all the Psets have been removed.
|
|
1848
|
-
*
|
|
1849
|
-
* @throws Will throw an error if any of the 'expressID' properties are missing in the 'psetID' array.
|
|
1850
|
-
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1851
|
-
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1852
|
-
*/
|
|
1853
|
-
removePset(model: FragmentsGroup, ...psetID: number[]): Promise<void>;
|
|
1854
|
-
/**
|
|
1855
|
-
* Creates a new single-value property of type string in the given model.
|
|
1856
|
-
*
|
|
1857
|
-
* @param model - The FragmentsGroup model in which to create the property.
|
|
1858
|
-
* @param type - The type of the property value. Must be a string property type.
|
|
1859
|
-
* @param name - The name of the property.
|
|
1860
|
-
* @param value - The value of the property. Must be a string.
|
|
1861
|
-
*
|
|
1862
|
-
* @returns The newly created single-value property.
|
|
1906
|
+
* Creates a plane in a certain place and with a certain orientation,
|
|
1907
|
+
* without the need of the mouse.
|
|
1863
1908
|
*
|
|
1864
|
-
* @
|
|
1865
|
-
* @
|
|
1909
|
+
* @param world - the world where this plane should be created.
|
|
1910
|
+
* @param normal - the orientation of the clipping plane.
|
|
1911
|
+
* @param point - the position of the clipping plane.
|
|
1912
|
+
* navigation.
|
|
1866
1913
|
*/
|
|
1867
|
-
|
|
1914
|
+
createFromNormalAndCoplanarPoint(world: World, normal: THREE.Vector3, point: THREE.Vector3): SimplePlane;
|
|
1868
1915
|
/**
|
|
1869
|
-
*
|
|
1870
|
-
*
|
|
1871
|
-
* @param model - The FragmentsGroup model in which to create the property.
|
|
1872
|
-
* @param type - The type of the property value. Must be a numeric property type.
|
|
1873
|
-
* @param name - The name of the property.
|
|
1874
|
-
* @param value - The value of the property. Must be a number.
|
|
1875
|
-
*
|
|
1876
|
-
* @returns The newly created single-value property.
|
|
1916
|
+
* {@link Createable.delete}
|
|
1877
1917
|
*
|
|
1878
|
-
* @
|
|
1879
|
-
* @
|
|
1918
|
+
* @param world - the world where the plane to delete is.
|
|
1919
|
+
* @param plane - the plane to delete. If undefined, the first plane
|
|
1920
|
+
* found under the cursor will be deleted.
|
|
1880
1921
|
*/
|
|
1881
|
-
|
|
1922
|
+
delete(world: World, plane?: SimplePlane): void;
|
|
1923
|
+
/** Deletes all the existing clipping planes. */
|
|
1924
|
+
deleteAll(): void;
|
|
1925
|
+
private deletePlane;
|
|
1926
|
+
private pickPlane;
|
|
1927
|
+
private getAllPlaneMeshes;
|
|
1928
|
+
private createPlaneFromIntersection;
|
|
1929
|
+
private getWorldNormal;
|
|
1930
|
+
private normalizePlaneDirectionY;
|
|
1931
|
+
private newPlane;
|
|
1932
|
+
private updateMaterialsAndPlanes;
|
|
1933
|
+
private _onStartDragging;
|
|
1934
|
+
private _onEndDragging;
|
|
1935
|
+
}
|
|
1936
|
+
import { Components } from "../Components";
|
|
1937
|
+
import { MeshCullerRenderer, CullerRendererSettings } from "./src";
|
|
1938
|
+
import { Component, Event, Disposable, World } from "../Types";
|
|
1939
|
+
/**
|
|
1940
|
+
* A component that provides culling functionality for meshes in a 3D scene. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/Cullers). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/Cullers).
|
|
1941
|
+
*/
|
|
1942
|
+
export declare class Cullers extends Component implements Disposable {
|
|
1882
1943
|
/**
|
|
1883
|
-
*
|
|
1884
|
-
*
|
|
1885
|
-
* @param model - The FragmentsGroup model in which to create the property.
|
|
1886
|
-
* @param type - The type of the property value. Must be a boolean property type.
|
|
1887
|
-
* @param name - The name of the property.
|
|
1888
|
-
* @param value - The value of the property. Must be a boolean.
|
|
1889
|
-
*
|
|
1890
|
-
* @returns The newly created single-value property.
|
|
1891
|
-
*
|
|
1892
|
-
* @throws Will throw an error if the IFC schema is not found in the model.
|
|
1893
|
-
* @throws Will throw an error if no OwnerHistory is found in the model.
|
|
1944
|
+
* A unique identifier for the component.
|
|
1945
|
+
* This UUID is used to register the component within the Components system.
|
|
1894
1946
|
*/
|
|
1895
|
-
|
|
1947
|
+
static readonly uuid: "69f2a50d-c266-44fc-b1bd-fa4d34be89e6";
|
|
1896
1948
|
/**
|
|
1897
|
-
*
|
|
1898
|
-
*
|
|
1899
|
-
* @param model - The FragmentsGroup model from which to remove the property.
|
|
1900
|
-
* @param psetID - The express ID of the Pset from which to remove the property.
|
|
1901
|
-
* @param propID - The express ID of the property to be removed.
|
|
1902
|
-
*
|
|
1903
|
-
* @returns {Promise<void>} A promise that resolves when the property has been removed.
|
|
1904
|
-
*
|
|
1905
|
-
* @throws Will throw an error if the Pset or the property to be removed are not found in the model.
|
|
1906
|
-
* @throws Will throw an error if the Pset to be removed is not of type 'IFCPROPERTYSET'.
|
|
1949
|
+
* An event that is triggered when the Cullers component is disposed.
|
|
1907
1950
|
*/
|
|
1908
|
-
|
|
1909
|
-
|
|
1951
|
+
readonly onDisposed: Event<unknown>;
|
|
1952
|
+
private _enabled;
|
|
1910
1953
|
/**
|
|
1911
|
-
*
|
|
1912
|
-
*
|
|
1913
|
-
* @param model - The FragmentsGroup model in which to add the elements.
|
|
1914
|
-
* @param psetID - The express ID of the Pset to which to add the elements.
|
|
1915
|
-
* @param elementID - The express IDs of the elements to be added.
|
|
1916
|
-
*
|
|
1917
|
-
* @returns {Promise<void>} A promise that resolves when all the elements have been added.
|
|
1918
|
-
*
|
|
1919
|
-
* @throws Will throw an error if the Pset or the elements to be added are not found in the model.
|
|
1920
|
-
* @throws Will throw an error if the Pset to be added to is not of type 'IFCPROPERTYSET'.
|
|
1921
|
-
* @throws Will throw an error if no relation is found between the Pset and the model.
|
|
1954
|
+
* A map of MeshCullerRenderer instances, keyed by their world UUIDs.
|
|
1922
1955
|
*/
|
|
1923
|
-
|
|
1956
|
+
list: Map<string, MeshCullerRenderer>;
|
|
1957
|
+
/** {@link Component.enabled} */
|
|
1958
|
+
get enabled(): boolean;
|
|
1959
|
+
/** {@link Component.enabled} */
|
|
1960
|
+
set enabled(value: boolean);
|
|
1961
|
+
constructor(components: Components);
|
|
1924
1962
|
/**
|
|
1925
|
-
*
|
|
1926
|
-
*
|
|
1927
|
-
* @param model - The FragmentsGroup model from which to save the changes.
|
|
1928
|
-
* @param ifcToSaveOn - The Uint8Array representing the original IFC file.
|
|
1963
|
+
* Creates a new MeshCullerRenderer for the given world.
|
|
1964
|
+
* If a MeshCullerRenderer already exists for the world, it will return the existing one.
|
|
1929
1965
|
*
|
|
1930
|
-
* @
|
|
1966
|
+
* @param world - The world for which to create the MeshCullerRenderer.
|
|
1967
|
+
* @param config - Optional configuration settings for the MeshCullerRenderer.
|
|
1931
1968
|
*
|
|
1932
|
-
* @
|
|
1969
|
+
* @returns The newly created or existing MeshCullerRenderer for the given world.
|
|
1933
1970
|
*/
|
|
1934
|
-
|
|
1971
|
+
create(world: World, config?: Partial<CullerRendererSettings>): MeshCullerRenderer;
|
|
1935
1972
|
/**
|
|
1936
|
-
*
|
|
1937
|
-
*
|
|
1938
|
-
*
|
|
1939
|
-
* @param model - The FragmentsGroup model in which to set the attribute listener.
|
|
1940
|
-
* @param expressID - The express ID of the entity for which to set the listener.
|
|
1941
|
-
* @param attributeName - The name of the attribute for which to set the listener.
|
|
1973
|
+
* Deletes the MeshCullerRenderer associated with the given world.
|
|
1974
|
+
* If a MeshCullerRenderer exists for the given world, it will be disposed and removed from the list.
|
|
1942
1975
|
*
|
|
1943
|
-
* @
|
|
1976
|
+
* @param world - The world for which to delete the MeshCullerRenderer.
|
|
1944
1977
|
*
|
|
1945
|
-
* @
|
|
1946
|
-
* @throws Will throw an error if the attribute is an array or null, and it can't have a listener.
|
|
1947
|
-
* @throws Will throw an error if the attribute has a badly defined handle.
|
|
1978
|
+
* @returns {void}
|
|
1948
1979
|
*/
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
private getOwnerHistory;
|
|
1953
|
-
private registerChange;
|
|
1954
|
-
private newSingleProperty;
|
|
1955
|
-
}
|
|
1956
|
-
export declare class UUID {
|
|
1957
|
-
private static _pattern;
|
|
1958
|
-
private static _lut;
|
|
1959
|
-
static create(): string;
|
|
1960
|
-
static validate(uuid: string): void;
|
|
1980
|
+
delete(world: World): void;
|
|
1981
|
+
/** {@link Disposable.dispose} */
|
|
1982
|
+
dispose(): void;
|
|
1961
1983
|
}
|
|
1962
|
-
import * as
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
* Configuration interface for the VertexPicker component.
|
|
1966
|
-
*/
|
|
1967
|
-
export interface VertexPickerConfig {
|
|
1968
|
-
/**
|
|
1969
|
-
* If true, only vertices will be picked, not the closest point on the face.
|
|
1970
|
-
*/
|
|
1971
|
-
showOnlyVertex: boolean;
|
|
1972
|
-
/**
|
|
1973
|
-
* The maximum distance for snapping to a vertex.
|
|
1974
|
-
*/
|
|
1975
|
-
snapDistance: number;
|
|
1976
|
-
/**
|
|
1977
|
-
* The HTML element to use for previewing the picked vertex.
|
|
1978
|
-
*/
|
|
1979
|
-
previewElement: HTMLElement;
|
|
1984
|
+
import * as WEBIFC from "web-ifc";
|
|
1985
|
+
export interface IfcItemsCategories {
|
|
1986
|
+
[itemID: number]: number;
|
|
1980
1987
|
}
|
|
1988
|
+
export declare class IfcCategories {
|
|
1989
|
+
getAll(webIfc: WEBIFC.IfcAPI, modelID: number): IfcItemsCategories;
|
|
1990
|
+
}
|
|
1991
|
+
import { MiniMap } from "./src";
|
|
1992
|
+
import { Component, Updateable, World, Event, Disposable } from "../Types";
|
|
1993
|
+
import { Components } from "../Components";
|
|
1981
1994
|
/**
|
|
1982
|
-
* A
|
|
1995
|
+
* A component that manages multiple {@link MiniMap} instances, each associated with a unique world ID. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/MiniMap). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/MiniMaps).
|
|
1983
1996
|
*/
|
|
1984
|
-
export declare class
|
|
1997
|
+
export declare class MiniMaps extends Component implements Updateable, Disposable {
|
|
1998
|
+
/**
|
|
1999
|
+
* A unique identifier for the component.
|
|
2000
|
+
* This UUID is used to register the component within the Components system.
|
|
2001
|
+
*/
|
|
2002
|
+
static readonly uuid: "39ad6aad-84c8-4adf-a1e0-7f25313a9e7f";
|
|
2003
|
+
/** {@link Updateable.onAfterUpdate} */
|
|
2004
|
+
readonly onAfterUpdate: Event<unknown>;
|
|
2005
|
+
/** {@link Updateable.onBeforeUpdate} */
|
|
2006
|
+
readonly onBeforeUpdate: Event<unknown>;
|
|
1985
2007
|
/** {@link Disposable.onDisposed} */
|
|
1986
2008
|
readonly onDisposed: Event<unknown>;
|
|
2009
|
+
/** {@link Component.enabled} */
|
|
2010
|
+
enabled: boolean;
|
|
1987
2011
|
/**
|
|
1988
|
-
*
|
|
1989
|
-
* The event passes a THREE.Vector3 representing the position of the found vertex.
|
|
2012
|
+
* A collection of {@link MiniMap} instances, each associated with a unique world ID.
|
|
1990
2013
|
*/
|
|
1991
|
-
|
|
2014
|
+
list: Map<string, MiniMap>;
|
|
2015
|
+
constructor(components: Components);
|
|
1992
2016
|
/**
|
|
1993
|
-
*
|
|
1994
|
-
*
|
|
2017
|
+
* Creates a new {@link MiniMap} instance associated with the given world.
|
|
2018
|
+
* If a {@link MiniMap} instance already exists for the given world, an error will be thrown.
|
|
2019
|
+
*
|
|
2020
|
+
* @param world - The {@link World} for which to create a {@link MiniMap} instance.
|
|
2021
|
+
* @returns The newly created {@link MiniMap} instance.
|
|
2022
|
+
* @throws Will throw an error if a {@link MiniMap} instance already exists for the given world.
|
|
1995
2023
|
*/
|
|
1996
|
-
|
|
2024
|
+
create(world: World): MiniMap;
|
|
1997
2025
|
/**
|
|
1998
|
-
*
|
|
2026
|
+
* Deletes a {@link MiniMap} instance associated with the given world ID.
|
|
2027
|
+
* If a {@link MiniMap} instance does not exist for the given ID, nothing happens.
|
|
2028
|
+
*
|
|
2029
|
+
* @param id - The unique identifier of the world for which to delete the {@link MiniMap} instance.
|
|
2030
|
+
* @returns {void}
|
|
1999
2031
|
*/
|
|
2000
|
-
|
|
2032
|
+
delete(id: string): void;
|
|
2033
|
+
/** {@link Disposable.dispose} */
|
|
2034
|
+
dispose(): void;
|
|
2035
|
+
/** {@link Updateable.update} */
|
|
2036
|
+
update(): void;
|
|
2037
|
+
}
|
|
2038
|
+
import * as THREE from "three";
|
|
2039
|
+
import { Components } from "../Components";
|
|
2040
|
+
import { SimpleCamera } from "..";
|
|
2041
|
+
import { NavigationMode, NavModeID, ProjectionManager } from "./src";
|
|
2042
|
+
/**
|
|
2043
|
+
* A flexible camera that uses [yomotsu's cameracontrols](https://github.com/yomotsu/camera-controls) to control the camera in 2D and 3D. It supports multiple navigation modes, such as 2D floor plan navigation, first person and 3D orbit. This class extends the SimpleCamera class and adds additional functionality for managing different camera projections and navigation modes. 📕 [Tutorial](https://docs.thatopen.com/Tutorials/Components/Core/OrthoPerspectiveCamera). 📘 [API](https://docs.thatopen.com/api/@thatopen/components/classes/OrthoPerspectiveCamera).
|
|
2044
|
+
*/
|
|
2045
|
+
export declare class OrthoPerspectiveCamera extends SimpleCamera {
|
|
2001
2046
|
/**
|
|
2002
|
-
* A
|
|
2047
|
+
* A ProjectionManager instance that manages the projection modes of the camera.
|
|
2003
2048
|
*/
|
|
2004
|
-
|
|
2049
|
+
readonly projection: ProjectionManager;
|
|
2005
2050
|
/**
|
|
2006
|
-
* A
|
|
2007
|
-
* This
|
|
2008
|
-
* If this value is null, all vertices are considered valid.
|
|
2051
|
+
* A THREE.OrthographicCamera instance that represents the orthographic camera.
|
|
2052
|
+
* This camera is used when the projection mode is set to orthographic.
|
|
2009
2053
|
*/
|
|
2010
|
-
|
|
2011
|
-
private _pickedPoint;
|
|
2012
|
-
private _config;
|
|
2013
|
-
private _enabled;
|
|
2054
|
+
readonly threeOrtho: THREE.OrthographicCamera;
|
|
2014
2055
|
/**
|
|
2015
|
-
*
|
|
2016
|
-
*
|
|
2017
|
-
* When disabled, the VertexPicker will stop searching for vertices and reset the picked point.
|
|
2018
|
-
*
|
|
2019
|
-
* @param value - The new enabled state.
|
|
2056
|
+
* A THREE.PerspectiveCamera instance that represents the perspective camera.
|
|
2057
|
+
* This camera is used when the projection mode is set to perspective.
|
|
2020
2058
|
*/
|
|
2021
|
-
|
|
2059
|
+
readonly threePersp: THREE.PerspectiveCamera;
|
|
2060
|
+
protected readonly _userInputButtons: any;
|
|
2061
|
+
protected readonly _frustumSize = 50;
|
|
2062
|
+
protected readonly _navigationModes: Map<NavModeID, NavigationMode>;
|
|
2063
|
+
protected _mode: NavigationMode | null;
|
|
2064
|
+
private previousSize;
|
|
2022
2065
|
/**
|
|
2023
|
-
*
|
|
2066
|
+
* Getter for the current navigation mode.
|
|
2067
|
+
* Throws an error if the mode is not found or the camera is not initialized.
|
|
2024
2068
|
*
|
|
2025
|
-
* @returns The current
|
|
2069
|
+
* @returns {NavigationMode} The current navigation mode.
|
|
2070
|
+
*
|
|
2071
|
+
* @throws {Error} Throws an error if the mode is not found or the camera is not initialized.
|
|
2026
2072
|
*/
|
|
2027
|
-
get
|
|
2073
|
+
get mode(): NavigationMode;
|
|
2074
|
+
constructor(components: Components);
|
|
2075
|
+
/** {@link Disposable.dispose} */
|
|
2076
|
+
dispose(): void;
|
|
2028
2077
|
/**
|
|
2029
|
-
* Sets
|
|
2030
|
-
*
|
|
2031
|
-
* @param value - A Partial object containing the configuration properties to update.
|
|
2032
|
-
* The properties not provided in the value object will retain their current values.
|
|
2078
|
+
* Sets a new {@link NavigationMode} and disables the previous one.
|
|
2033
2079
|
*
|
|
2034
|
-
* @
|
|
2035
|
-
* '''typescript
|
|
2036
|
-
* vertexPicker.config = {
|
|
2037
|
-
* snapDistance: 0.5,
|
|
2038
|
-
* showOnlyVertex: true,
|
|
2039
|
-
* };
|
|
2040
|
-
* '''
|
|
2080
|
+
* @param mode - The {@link NavigationMode} to set.
|
|
2041
2081
|
*/
|
|
2042
|
-
set
|
|
2082
|
+
set(mode: NavModeID): void;
|
|
2043
2083
|
/**
|
|
2044
|
-
*
|
|
2045
|
-
*
|
|
2046
|
-
* @returns A copy of the current VertexPickerConfig object.
|
|
2084
|
+
* Make the camera view fit all the specified meshes.
|
|
2047
2085
|
*
|
|
2048
|
-
* @
|
|
2049
|
-
*
|
|
2050
|
-
*
|
|
2051
|
-
* console.log(currentConfig.snapDistance); // Output: 0.25
|
|
2052
|
-
* '''
|
|
2086
|
+
* @param meshes the meshes to fit. If it is not defined, it will
|
|
2087
|
+
* evaluate {@link Components.meshes}.
|
|
2088
|
+
* @param offset the distance to the fit object
|
|
2053
2089
|
*/
|
|
2054
|
-
|
|
2055
|
-
constructor(components: Components, config?: Partial<VertexPickerConfig>);
|
|
2056
|
-
/** {@link Disposable.dispose} */
|
|
2057
|
-
dispose(): void;
|
|
2090
|
+
fit(meshes: Iterable<THREE.Mesh>, offset?: number): Promise<void>;
|
|
2058
2091
|
/**
|
|
2059
|
-
*
|
|
2060
|
-
*
|
|
2061
|
-
* @param world - The World instance to use for raycasting.
|
|
2062
|
-
*
|
|
2063
|
-
* @returns The current picked point, or null if no point is picked.
|
|
2092
|
+
* Allows or prevents all user input.
|
|
2064
2093
|
*
|
|
2065
|
-
* @
|
|
2066
|
-
* This method checks if the VertexPicker is enabled. If not, it returns the current picked point.
|
|
2067
|
-
* If enabled, it performs raycasting to find the closest intersecting object.
|
|
2068
|
-
* It then determines the closest vertex or point on the face, based on the configuration settings.
|
|
2069
|
-
* If the picked point is on the working plane (if defined), it triggers the 'onVertexFound' event and updates the 'pickedPoint'.
|
|
2070
|
-
* If the picked point is not on the working plane, it resets the 'pickedPoint'.
|
|
2071
|
-
* If no intersecting object is found, it triggers the 'onVertexLost' event and resets the 'pickedPoint'.
|
|
2094
|
+
* @param active - whether to enable or disable user inputs.
|
|
2072
2095
|
*/
|
|
2073
|
-
|
|
2074
|
-
private
|
|
2075
|
-
private
|
|
2076
|
-
private
|
|
2096
|
+
setUserInput(active: boolean): void;
|
|
2097
|
+
private disableUserInput;
|
|
2098
|
+
private enableUserInput;
|
|
2099
|
+
private newOrthoCamera;
|
|
2100
|
+
private setOrthoPerspCameraAspect;
|
|
2101
|
+
}
|
|
2102
|
+
/**
|
|
2103
|
+
* 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.
|
|
2104
|
+
*
|
|
2105
|
+
* @remarks
|
|
2106
|
+
* This map is used to provide a mapping between IFC entity type numbers and their names.
|
|
2107
|
+
* It is useful for identifying and processing different types of IFC elements in a project.
|
|
2108
|
+
*
|
|
2109
|
+
*/
|
|
2110
|
+
export declare const IfcElements: {
|
|
2111
|
+
[key: number]: string;
|
|
2112
|
+
};
|
|
2113
|
+
/**
|
|
2114
|
+
* 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.
|
|
2115
|
+
*/
|
|
2116
|
+
export declare const IfcCategoryMap: {
|
|
2117
|
+
[key: number]: string;
|
|
2118
|
+
};
|
|
2119
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
2120
|
+
export declare class IfcPropertiesUtils {
|
|
2121
|
+
static getUnits(group: FRAGS.FragmentsGroup): Promise<number>;
|
|
2122
|
+
static findItemByGuid(model: FRAGS.FragmentsGroup, guid: string): Promise<{
|
|
2123
|
+
[attribute: string]: any;
|
|
2124
|
+
} | null>;
|
|
2125
|
+
static getRelationMap(model: FRAGS.FragmentsGroup, relationType: number, onElementsFound?: (relatingID: number, relatedIDs: number[]) => Promise<void>): Promise<{
|
|
2126
|
+
[relatingID: number]: number[];
|
|
2127
|
+
}>;
|
|
2128
|
+
static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2129
|
+
static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2130
|
+
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
2131
|
+
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
2132
|
+
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
2133
|
+
key: string | null;
|
|
2134
|
+
name: string | null;
|
|
2135
|
+
}>;
|
|
2136
|
+
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
2137
|
+
key: string | null;
|
|
2138
|
+
value: number | null;
|
|
2139
|
+
}>;
|
|
2140
|
+
static isRel(expressID: number): boolean;
|
|
2141
|
+
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2142
|
+
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2077
2143
|
}
|
|
2144
|
+
/**
|
|
2145
|
+
* A Set of unique numbers representing different types of IFC geometries.
|
|
2146
|
+
*/
|
|
2147
|
+
export declare const GeometryTypes: Set<number>;
|
|
2078
2148
|
import * as WEBIFC from "web-ifc";
|
|
2079
2149
|
/** Configuration of the IFC-fragment conversion. */
|
|
2080
2150
|
export declare class IfcFragmentSettings {
|
|
@@ -2116,6 +2186,19 @@ export declare class IfcFragmentSettings {
|
|
|
2116
2186
|
*/
|
|
2117
2187
|
customLocateFileHandler: WEBIFC.LocateFileHandlerFn | null;
|
|
2118
2188
|
}
|
|
2189
|
+
import * as WEBIFC from "web-ifc";
|
|
2190
|
+
import { IfcItemsCategories } from "../../../ifc";
|
|
2191
|
+
export declare class SpatialStructure {
|
|
2192
|
+
itemsByFloor: IfcItemsCategories;
|
|
2193
|
+
private _units;
|
|
2194
|
+
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2195
|
+
cleanUp(): void;
|
|
2196
|
+
}
|
|
2197
|
+
import { InverseAttribute } from "./types";
|
|
2198
|
+
export declare const relToAttributesMap: Map<number, {
|
|
2199
|
+
forRelating: InverseAttribute;
|
|
2200
|
+
forRelated: InverseAttribute;
|
|
2201
|
+
}>;
|
|
2119
2202
|
import * as THREE from "three";
|
|
2120
2203
|
import { Resizeable, Updateable, World, Event, Disposable } from "../../Types";
|
|
2121
2204
|
/**
|
|
@@ -2205,72 +2288,92 @@ export declare class MiniMap implements Resizeable, Updateable, Disposable {
|
|
|
2205
2288
|
resize(size?: THREE.Vector2): void;
|
|
2206
2289
|
private updatePlanes;
|
|
2207
2290
|
}
|
|
2208
|
-
/**
|
|
2209
|
-
* A Set of unique numbers representing different types of IFC geometries.
|
|
2210
|
-
*/
|
|
2211
|
-
export declare const GeometryTypes: Set<number>;
|
|
2212
2291
|
import * as WEBIFC from "web-ifc";
|
|
2213
|
-
import
|
|
2214
|
-
export declare class
|
|
2215
|
-
|
|
2216
|
-
|
|
2292
|
+
import * as THREE from "three";
|
|
2293
|
+
export declare class Units {
|
|
2294
|
+
factor: number;
|
|
2295
|
+
complement: number;
|
|
2296
|
+
apply(matrix: THREE.Matrix4): void;
|
|
2217
2297
|
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
2218
|
-
|
|
2298
|
+
private getLengthUnits;
|
|
2299
|
+
private getScaleMatrix;
|
|
2219
2300
|
}
|
|
2301
|
+
import * as THREE from "three";
|
|
2220
2302
|
import * as WEBIFC from "web-ifc";
|
|
2221
|
-
|
|
2222
|
-
|
|
2303
|
+
import * as FRAGS from "@thatopen/fragments";
|
|
2304
|
+
export declare class CivilReader {
|
|
2305
|
+
defLineMat: THREE.LineBasicMaterial;
|
|
2306
|
+
read(webIfc: WEBIFC.IfcAPI): {
|
|
2307
|
+
alignments: Map<number, FRAGS.Alignment>;
|
|
2308
|
+
coordinationMatrix: THREE.Matrix4;
|
|
2309
|
+
} | undefined;
|
|
2310
|
+
get(civilItems: any): {
|
|
2311
|
+
alignments: Map<number, FRAGS.Alignment>;
|
|
2312
|
+
coordinationMatrix: THREE.Matrix4;
|
|
2313
|
+
} | undefined;
|
|
2314
|
+
private getCurves;
|
|
2315
|
+
}
|
|
2316
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
2317
|
+
/**
|
|
2318
|
+
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
2319
|
+
*/
|
|
2320
|
+
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
2321
|
+
/**
|
|
2322
|
+
* Amount of properties to be streamed.
|
|
2323
|
+
* Defaults to 100 properties.
|
|
2324
|
+
*/
|
|
2325
|
+
propertiesSize: number;
|
|
2326
|
+
}
|
|
2327
|
+
import * as WEBIFC from "web-ifc";
|
|
2328
|
+
export declare class IfcMetadataReader {
|
|
2329
|
+
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
2330
|
+
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
2223
2331
|
}
|
|
2224
|
-
|
|
2225
|
-
|
|
2332
|
+
/**
|
|
2333
|
+
* A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
|
|
2334
|
+
*/
|
|
2335
|
+
export interface StreamedGeometries {
|
|
2336
|
+
[id: number]: {
|
|
2337
|
+
/** The bounding box of the geometry as a Float32Array. */
|
|
2338
|
+
boundingBox: Float32Array;
|
|
2339
|
+
/** A boolean indicating whether the geometry has holes. */
|
|
2340
|
+
hasHoles: boolean;
|
|
2341
|
+
/** An optional file path for the geometry data. */
|
|
2342
|
+
geometryFile?: string;
|
|
2343
|
+
};
|
|
2226
2344
|
}
|
|
2227
2345
|
/**
|
|
2228
|
-
* A
|
|
2346
|
+
* A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
|
|
2229
2347
|
*/
|
|
2230
|
-
export
|
|
2231
|
-
|
|
2232
|
-
|
|
2348
|
+
export interface StreamedAsset {
|
|
2349
|
+
/** The unique identifier of the asset. */
|
|
2350
|
+
id: number;
|
|
2351
|
+
/** An array of geometries associated with the asset. */
|
|
2352
|
+
geometries: {
|
|
2353
|
+
/** The unique identifier of the geometry. */
|
|
2354
|
+
geometryID: number;
|
|
2355
|
+
/** The transformation matrix of the geometry as a number array. */
|
|
2356
|
+
transformation: number[];
|
|
2357
|
+
/** The color of the geometry as a number array. */
|
|
2358
|
+
color: number[];
|
|
2359
|
+
}[];
|
|
2360
|
+
}
|
|
2361
|
+
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
2233
2362
|
/**
|
|
2234
|
-
*
|
|
2235
|
-
*
|
|
2236
|
-
* @remarks
|
|
2237
|
-
* This map is used to provide a mapping between IFC entity type numbers and their names.
|
|
2238
|
-
* It is useful for identifying and processing different types of IFC elements in a project.
|
|
2239
|
-
*
|
|
2363
|
+
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
2240
2364
|
*/
|
|
2241
|
-
export declare
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
}>;
|
|
2253
|
-
static getQsetQuantities(model: FRAGS.FragmentsGroup, expressID: number, onQuantityFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2254
|
-
static getPsetProps(model: FRAGS.FragmentsGroup, expressID: number, onPropFound?: (expressID: number) => void): Promise<number[] | null>;
|
|
2255
|
-
static getPsetRel(model: FRAGS.FragmentsGroup, psetID: number): Promise<number | null>;
|
|
2256
|
-
static getQsetRel(model: FRAGS.FragmentsGroup, qsetID: number): Promise<number | null>;
|
|
2257
|
-
static getEntityName(model: FRAGS.FragmentsGroup, entityID: number): Promise<{
|
|
2258
|
-
key: string | null;
|
|
2259
|
-
name: string | null;
|
|
2260
|
-
}>;
|
|
2261
|
-
static getQuantityValue(model: FRAGS.FragmentsGroup, quantityID: number): Promise<{
|
|
2262
|
-
key: string | null;
|
|
2263
|
-
value: number | null;
|
|
2264
|
-
}>;
|
|
2265
|
-
static isRel(expressID: number): boolean;
|
|
2266
|
-
static attributeExists(model: FRAGS.FragmentsGroup, expressID: number, attribute: string): Promise<boolean>;
|
|
2267
|
-
static groupEntitiesByType(model: FRAGS.FragmentsGroup, expressIDs: Set<number> | number[]): Promise<Map<number, Set<number>>>;
|
|
2365
|
+
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
2366
|
+
/**
|
|
2367
|
+
* Minimum number of geometries to be streamed.
|
|
2368
|
+
* Defaults to 10 geometries.
|
|
2369
|
+
*/
|
|
2370
|
+
minGeometrySize: number;
|
|
2371
|
+
/**
|
|
2372
|
+
* Minimum amount of assets to be streamed.
|
|
2373
|
+
* Defaults to 1000 assets.
|
|
2374
|
+
*/
|
|
2375
|
+
minAssetsSize: number;
|
|
2268
2376
|
}
|
|
2269
|
-
import { InverseAttribute } from "./types";
|
|
2270
|
-
export declare const relToAttributesMap: Map<number, {
|
|
2271
|
-
forRelating: InverseAttribute;
|
|
2272
|
-
forRelated: InverseAttribute;
|
|
2273
|
-
}>;
|
|
2274
2377
|
import * as THREE from "three";
|
|
2275
2378
|
import { BaseScene, Configurable, Event } from "../../Types";
|
|
2276
2379
|
import { Components } from "../../Components";
|
|
@@ -2597,27 +2700,63 @@ export declare class CullerRenderer {
|
|
|
2597
2700
|
private applySettings;
|
|
2598
2701
|
}
|
|
2599
2702
|
import * as THREE from "three";
|
|
2600
|
-
import {
|
|
2703
|
+
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
2704
|
+
import { Components } from "../../Components";
|
|
2601
2705
|
/**
|
|
2602
|
-
*
|
|
2706
|
+
* Configuration interface for the {@link SimpleGrid} class.
|
|
2603
2707
|
*/
|
|
2604
|
-
export
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2708
|
+
export interface GridConfig {
|
|
2709
|
+
/**
|
|
2710
|
+
* The color of the grid lines.
|
|
2711
|
+
*/
|
|
2712
|
+
color: THREE.Color;
|
|
2713
|
+
/**
|
|
2714
|
+
* The size of the primary grid lines.
|
|
2715
|
+
*/
|
|
2716
|
+
size1: number;
|
|
2717
|
+
/**
|
|
2718
|
+
* The size of the secondary grid lines.
|
|
2719
|
+
*/
|
|
2720
|
+
size2: number;
|
|
2721
|
+
/**
|
|
2722
|
+
* The distance at which the grid lines start to fade away.
|
|
2723
|
+
*/
|
|
2724
|
+
distance: number;
|
|
2725
|
+
}
|
|
2726
|
+
/**
|
|
2727
|
+
* An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
|
|
2728
|
+
*/
|
|
2729
|
+
export declare class SimpleGrid implements Hideable, Disposable {
|
|
2608
2730
|
/** {@link Disposable.onDisposed} */
|
|
2609
2731
|
readonly onDisposed: Event<unknown>;
|
|
2610
|
-
|
|
2732
|
+
/** The world instance to which this Raycaster belongs. */
|
|
2733
|
+
world: World;
|
|
2734
|
+
/** The components instance to which this grid belongs. */
|
|
2735
|
+
components: Components;
|
|
2736
|
+
/** {@link Hideable.visible} */
|
|
2737
|
+
get visible(): boolean;
|
|
2738
|
+
/** {@link Hideable.visible} */
|
|
2739
|
+
set visible(visible: boolean);
|
|
2740
|
+
/** The material of the grid. */
|
|
2741
|
+
get material(): THREE.ShaderMaterial;
|
|
2611
2742
|
/**
|
|
2612
|
-
*
|
|
2743
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2744
|
+
* perspective cameras and false for orthographic cameras.
|
|
2613
2745
|
*/
|
|
2614
|
-
get
|
|
2746
|
+
get fade(): boolean;
|
|
2747
|
+
/**
|
|
2748
|
+
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2749
|
+
* perspective cameras and false for orthographic cameras.
|
|
2750
|
+
*/
|
|
2751
|
+
set fade(active: boolean);
|
|
2752
|
+
/** The Three.js mesh that contains the infinite grid. */
|
|
2753
|
+
readonly three: THREE.Mesh;
|
|
2754
|
+
private _fade;
|
|
2755
|
+
constructor(components: Components, world: World, config: GridConfig);
|
|
2615
2756
|
/** {@link Disposable.dispose} */
|
|
2616
2757
|
dispose(): void;
|
|
2617
|
-
private getPositionY;
|
|
2618
|
-
private getPositionX;
|
|
2619
|
-
private updateMouseInfo;
|
|
2620
2758
|
private setupEvents;
|
|
2759
|
+
private updateZoom;
|
|
2621
2760
|
}
|
|
2622
2761
|
import * as THREE from "three";
|
|
2623
2762
|
import { CullerRenderer, CullerRendererSettings } from "./culler-renderer";
|
|
@@ -2661,131 +2800,19 @@ export declare class MeshCullerRenderer extends CullerRenderer implements Dispos
|
|
|
2661
2800
|
dispose(): void;
|
|
2662
2801
|
/**
|
|
2663
2802
|
* Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
|
|
2664
|
-
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2665
|
-
* @returns {void}
|
|
2666
|
-
*/
|
|
2667
|
-
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2668
|
-
/**
|
|
2669
|
-
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
2670
|
-
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
2671
|
-
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2672
|
-
* @returns {void}
|
|
2673
|
-
*/
|
|
2674
|
-
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2675
|
-
private handleWorkerMessage;
|
|
2676
|
-
private getAvailableMaterial;
|
|
2677
|
-
}
|
|
2678
|
-
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
2679
|
-
import * as THREE from "three";
|
|
2680
|
-
import { Components } from "../../Components";
|
|
2681
|
-
import { Event, World, Disposable } from "../../Types";
|
|
2682
|
-
import { Mouse } from "./mouse";
|
|
2683
|
-
/**
|
|
2684
|
-
* A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
|
|
2685
|
-
*/
|
|
2686
|
-
export declare class SimpleRaycaster implements Disposable {
|
|
2687
|
-
/** {@link Component.enabled} */
|
|
2688
|
-
enabled: boolean;
|
|
2689
|
-
/** The components instance to which this Raycaster belongs. */
|
|
2690
|
-
components: Components;
|
|
2691
|
-
/** {@link Disposable.onDisposed} */
|
|
2692
|
-
readonly onDisposed: Event<unknown>;
|
|
2693
|
-
/** The position of the mouse in the screen. */
|
|
2694
|
-
readonly mouse: Mouse;
|
|
2695
|
-
/**
|
|
2696
|
-
* A reference to the Three.js Raycaster instance.
|
|
2697
|
-
* This is used for raycasting operations.
|
|
2698
|
-
*/
|
|
2699
|
-
readonly three: THREE.Raycaster;
|
|
2700
|
-
/**
|
|
2701
|
-
* A reference to the world instance to which this Raycaster belongs.
|
|
2702
|
-
* This is used to access the camera and meshes.
|
|
2703
|
-
*/
|
|
2704
|
-
world: World;
|
|
2705
|
-
constructor(components: Components, world: World);
|
|
2706
|
-
/** {@link Disposable.dispose} */
|
|
2707
|
-
dispose(): void;
|
|
2708
|
-
/**
|
|
2709
|
-
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
2710
|
-
* the first item found. This also takes into account the clipping planes
|
|
2711
|
-
* used by the renderer.
|
|
2712
|
-
*
|
|
2713
|
-
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
2714
|
-
* to query. If not provided, it will query all the meshes stored in
|
|
2715
|
-
* {@link Components.meshes}.
|
|
2716
|
-
*/
|
|
2717
|
-
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
2718
|
-
/**
|
|
2719
|
-
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
2720
|
-
* This method also takes into account the clipping planes used by the renderer.
|
|
2721
|
-
*
|
|
2722
|
-
* @param origin - The origin of the ray.
|
|
2723
|
-
* @param direction - The direction of the ray.
|
|
2724
|
-
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
2725
|
-
* @returns The first intersection found or 'null' if no intersection was found.
|
|
2726
|
-
*/
|
|
2727
|
-
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;
|
|
2728
|
-
private intersect;
|
|
2729
|
-
private filterClippingPlanes;
|
|
2730
|
-
}
|
|
2731
|
-
import * as THREE from "three";
|
|
2732
|
-
import { Hideable, Event, World, Disposable } from "../../Types";
|
|
2733
|
-
import { Components } from "../../Components";
|
|
2734
|
-
/**
|
|
2735
|
-
* Configuration interface for the {@link SimpleGrid} class.
|
|
2736
|
-
*/
|
|
2737
|
-
export interface GridConfig {
|
|
2738
|
-
/**
|
|
2739
|
-
* The color of the grid lines.
|
|
2740
|
-
*/
|
|
2741
|
-
color: THREE.Color;
|
|
2742
|
-
/**
|
|
2743
|
-
* The size of the primary grid lines.
|
|
2744
|
-
*/
|
|
2745
|
-
size1: number;
|
|
2746
|
-
/**
|
|
2747
|
-
* The size of the secondary grid lines.
|
|
2748
|
-
*/
|
|
2749
|
-
size2: number;
|
|
2750
|
-
/**
|
|
2751
|
-
* The distance at which the grid lines start to fade away.
|
|
2752
|
-
*/
|
|
2753
|
-
distance: number;
|
|
2754
|
-
}
|
|
2755
|
-
/**
|
|
2756
|
-
* An infinite grid. Created by [fyrestar](https://github.com/Fyrestar/THREE.InfiniteGridHelper) and translated to typescript by [dkaraush](https://github.com/dkaraush/THREE.InfiniteGridHelper/blob/master/InfiniteGridHelper.ts).
|
|
2757
|
-
*/
|
|
2758
|
-
export declare class SimpleGrid implements Hideable, Disposable {
|
|
2759
|
-
/** {@link Disposable.onDisposed} */
|
|
2760
|
-
readonly onDisposed: Event<unknown>;
|
|
2761
|
-
/** The world instance to which this Raycaster belongs. */
|
|
2762
|
-
world: World;
|
|
2763
|
-
/** The components instance to which this grid belongs. */
|
|
2764
|
-
components: Components;
|
|
2765
|
-
/** {@link Hideable.visible} */
|
|
2766
|
-
get visible(): boolean;
|
|
2767
|
-
/** {@link Hideable.visible} */
|
|
2768
|
-
set visible(visible: boolean);
|
|
2769
|
-
/** The material of the grid. */
|
|
2770
|
-
get material(): THREE.ShaderMaterial;
|
|
2771
|
-
/**
|
|
2772
|
-
* Whether the grid should fade away with distance. Recommended to be true for
|
|
2773
|
-
* perspective cameras and false for orthographic cameras.
|
|
2803
|
+
* @param mesh - The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2804
|
+
* @returns {void}
|
|
2774
2805
|
*/
|
|
2775
|
-
|
|
2806
|
+
add(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2776
2807
|
/**
|
|
2777
|
-
*
|
|
2778
|
-
*
|
|
2808
|
+
* Removes a mesh from the culler, so its visibility is not controlled by the culler anymore.
|
|
2809
|
+
* When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
|
|
2810
|
+
* @param mesh - The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh.
|
|
2811
|
+
* @returns {void}
|
|
2779
2812
|
*/
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
private _fade;
|
|
2784
|
-
constructor(components: Components, world: World, config: GridConfig);
|
|
2785
|
-
/** {@link Disposable.dispose} */
|
|
2786
|
-
dispose(): void;
|
|
2787
|
-
private setupEvents;
|
|
2788
|
-
private updateZoom;
|
|
2813
|
+
remove(mesh: THREE.Mesh | THREE.InstancedMesh): void;
|
|
2814
|
+
private handleWorkerMessage;
|
|
2815
|
+
private getAvailableMaterial;
|
|
2789
2816
|
}
|
|
2790
2817
|
/**
|
|
2791
2818
|
* Simple event handler by [Jason Kleban](https://gist.github.com/JasonKleban/50cee44960c225ac1993c922563aa540). Keep in mind that if you want to remove it later, you might want to declare the callback as an object. If you want to maintain the reference to 'this', you will need to declare the callback as an arrow function.
|
|
@@ -2843,6 +2870,7 @@ export declare class AsyncEvent<T> {
|
|
|
2843
2870
|
reset(): void;
|
|
2844
2871
|
private handlers;
|
|
2845
2872
|
}
|
|
2873
|
+
export declare function readPixelsAsync(gl: WebGL2RenderingContext, x: number, y: number, w: number, h: number, format: any, type: any, dest: ArrayBufferView): Promise<ArrayBufferView>;
|
|
2846
2874
|
import * as THREE from "three";
|
|
2847
2875
|
import CameraControls from "camera-controls";
|
|
2848
2876
|
import { Event } from "./event";
|
|
@@ -2952,29 +2980,6 @@ export interface CameraControllable {
|
|
|
2952
2980
|
controls: CameraControls;
|
|
2953
2981
|
}
|
|
2954
2982
|
import { Base } from "./base";
|
|
2955
|
-
import { World } from "./world";
|
|
2956
|
-
import { Event } from "./event";
|
|
2957
|
-
import { Components } from "../../Components";
|
|
2958
|
-
/**
|
|
2959
|
-
* One of the elements that make a world. It can be either a scene, a camera or a renderer.
|
|
2960
|
-
*/
|
|
2961
|
-
export declare abstract class BaseWorldItem extends Base {
|
|
2962
|
-
readonly worlds: Map<string, World>;
|
|
2963
|
-
/**
|
|
2964
|
-
* Event that is triggered when a world is added or removed from the 'worlds' map.
|
|
2965
|
-
* The event payload contains the world instance and the action ("added" or "removed").
|
|
2966
|
-
*/
|
|
2967
|
-
readonly onWorldChanged: Event<{
|
|
2968
|
-
world: World;
|
|
2969
|
-
action: "added" | "removed";
|
|
2970
|
-
}>;
|
|
2971
|
-
/**
|
|
2972
|
-
* The current world this item is associated with. It can be null if no world is currently active.
|
|
2973
|
-
*/
|
|
2974
|
-
currentWorld: World | null;
|
|
2975
|
-
protected constructor(components: Components);
|
|
2976
|
-
}
|
|
2977
|
-
import { Base } from "./base";
|
|
2978
2983
|
/**
|
|
2979
2984
|
* Components are the building blocks of this library. Components are singleton elements that contain specific functionality. For instance, the Clipper Component can create, delete and handle 3D clipping planes. Components must be unique (they can't be instanced more than once per Components instance), and have a static UUID that identifies them uniquely. The can be accessed globally using the {@link Components} instance.
|
|
2980
2985
|
*/
|
|
@@ -3006,6 +3011,29 @@ export declare abstract class Base {
|
|
|
3006
3011
|
/** Whether is component is {@link Configurable}. */
|
|
3007
3012
|
isConfigurable: () => this is Configurable<any>;
|
|
3008
3013
|
}
|
|
3014
|
+
import { Base } from "./base";
|
|
3015
|
+
import { World } from "./world";
|
|
3016
|
+
import { Event } from "./event";
|
|
3017
|
+
import { Components } from "../../Components";
|
|
3018
|
+
/**
|
|
3019
|
+
* One of the elements that make a world. It can be either a scene, a camera or a renderer.
|
|
3020
|
+
*/
|
|
3021
|
+
export declare abstract class BaseWorldItem extends Base {
|
|
3022
|
+
readonly worlds: Map<string, World>;
|
|
3023
|
+
/**
|
|
3024
|
+
* Event that is triggered when a world is added or removed from the 'worlds' map.
|
|
3025
|
+
* The event payload contains the world instance and the action ("added" or "removed").
|
|
3026
|
+
*/
|
|
3027
|
+
readonly onWorldChanged: Event<{
|
|
3028
|
+
world: World;
|
|
3029
|
+
action: "added" | "removed";
|
|
3030
|
+
}>;
|
|
3031
|
+
/**
|
|
3032
|
+
* The current world this item is associated with. It can be null if no world is currently active.
|
|
3033
|
+
*/
|
|
3034
|
+
currentWorld: World | null;
|
|
3035
|
+
protected constructor(components: Components);
|
|
3036
|
+
}
|
|
3009
3037
|
import * as THREE from "three";
|
|
3010
3038
|
import { Vector2 } from "three";
|
|
3011
3039
|
import { Event } from "./event";
|
|
@@ -3100,6 +3128,40 @@ export declare abstract class BaseCamera extends BaseWorldItem {
|
|
|
3100
3128
|
hasCameraControls: () => this is CameraControllable;
|
|
3101
3129
|
}
|
|
3102
3130
|
import * as THREE from "three";
|
|
3131
|
+
import { BaseScene } from "./base-scene";
|
|
3132
|
+
import { BaseCamera } from "./base-camera";
|
|
3133
|
+
import { BaseRenderer } from "./base-renderer";
|
|
3134
|
+
import { Updateable, Disposable } from "./interfaces";
|
|
3135
|
+
/**
|
|
3136
|
+
* Represents a 3D world with meshes, scene, camera, renderer, and other properties.
|
|
3137
|
+
*/
|
|
3138
|
+
export interface World extends Disposable, Updateable {
|
|
3139
|
+
/**
|
|
3140
|
+
* A set of meshes present in the world. This is taken into account for operations like raycasting.
|
|
3141
|
+
*/
|
|
3142
|
+
meshes: Set<THREE.Mesh>;
|
|
3143
|
+
/**
|
|
3144
|
+
* The base scene of the world.
|
|
3145
|
+
*/
|
|
3146
|
+
scene: BaseScene;
|
|
3147
|
+
/**
|
|
3148
|
+
* The base camera of the world.
|
|
3149
|
+
*/
|
|
3150
|
+
camera: BaseCamera;
|
|
3151
|
+
/**
|
|
3152
|
+
* The base renderer of the world. Can be null if this world doesn't use a renderer (e.g. in a backend environment).
|
|
3153
|
+
*/
|
|
3154
|
+
renderer: BaseRenderer | null;
|
|
3155
|
+
/**
|
|
3156
|
+
* A unique identifier for the world.
|
|
3157
|
+
*/
|
|
3158
|
+
uuid: string;
|
|
3159
|
+
/**
|
|
3160
|
+
* Indicates whether the world is currently disposing. This is useful for cancelling logic that access the elements of a world (which are also disposed).
|
|
3161
|
+
*/
|
|
3162
|
+
isDisposing: boolean;
|
|
3163
|
+
}
|
|
3164
|
+
import * as THREE from "three";
|
|
3103
3165
|
import { Disposable } from "./interfaces";
|
|
3104
3166
|
import { Event } from "./event";
|
|
3105
3167
|
import { Components } from "../../Components";
|
|
@@ -3119,39 +3181,203 @@ export declare abstract class BaseScene extends BaseWorldItem implements Disposa
|
|
|
3119
3181
|
/** {@link Disposable.dispose} */
|
|
3120
3182
|
dispose(): void;
|
|
3121
3183
|
}
|
|
3184
|
+
import { NavigationMode } from "./types";
|
|
3185
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3186
|
+
/**
|
|
3187
|
+
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
3188
|
+
*/
|
|
3189
|
+
export declare class OrbitMode implements NavigationMode {
|
|
3190
|
+
camera: OrthoPerspectiveCamera;
|
|
3191
|
+
/** {@link NavigationMode.enabled} */
|
|
3192
|
+
enabled: boolean;
|
|
3193
|
+
/** {@link NavigationMode.id} */
|
|
3194
|
+
readonly id = "Orbit";
|
|
3195
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3196
|
+
/** {@link NavigationMode.set} */
|
|
3197
|
+
set(active: boolean): void;
|
|
3198
|
+
private activateOrbitControls;
|
|
3199
|
+
}
|
|
3200
|
+
import { NavigationMode } from "./types";
|
|
3201
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3202
|
+
/**
|
|
3203
|
+
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
3204
|
+
*/
|
|
3205
|
+
export declare class FirstPersonMode implements NavigationMode {
|
|
3206
|
+
private camera;
|
|
3207
|
+
/** {@link NavigationMode.enabled} */
|
|
3208
|
+
enabled: boolean;
|
|
3209
|
+
/** {@link NavigationMode.id} */
|
|
3210
|
+
readonly id = "FirstPerson";
|
|
3211
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3212
|
+
/** {@link NavigationMode.set} */
|
|
3213
|
+
set(active: boolean): void;
|
|
3214
|
+
private setupFirstPersonCamera;
|
|
3215
|
+
}
|
|
3216
|
+
/**
|
|
3217
|
+
* The projection system of the camera.
|
|
3218
|
+
*/
|
|
3219
|
+
export type CameraProjection = "Perspective" | "Orthographic";
|
|
3220
|
+
/**
|
|
3221
|
+
* The extensible list of supported navigation modes.
|
|
3222
|
+
*/
|
|
3223
|
+
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
3224
|
+
/**
|
|
3225
|
+
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3226
|
+
*/
|
|
3227
|
+
export interface NavigationMode {
|
|
3228
|
+
/** The unique ID of this navigation mode. */
|
|
3229
|
+
id: NavModeID;
|
|
3230
|
+
/**
|
|
3231
|
+
* Enable or disable this navigation mode.
|
|
3232
|
+
* When a new navigation mode is enabled, the previous navigation mode
|
|
3233
|
+
* must be disabled.
|
|
3234
|
+
*
|
|
3235
|
+
* @param active - whether to enable or disable this mode.
|
|
3236
|
+
* @param options - any additional data required to enable or disable it.
|
|
3237
|
+
* */
|
|
3238
|
+
set: (active: boolean, options?: any) => void;
|
|
3239
|
+
/** Whether this navigation mode is active or not. */
|
|
3240
|
+
enabled: boolean;
|
|
3241
|
+
}
|
|
3122
3242
|
import * as THREE from "three";
|
|
3123
|
-
import {
|
|
3124
|
-
import {
|
|
3125
|
-
import {
|
|
3126
|
-
import { Updateable, Disposable } from "./interfaces";
|
|
3243
|
+
import { CameraProjection } from "./types";
|
|
3244
|
+
import { Event } from "../../Types";
|
|
3245
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3127
3246
|
/**
|
|
3128
|
-
*
|
|
3247
|
+
* Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3129
3248
|
*/
|
|
3130
|
-
export
|
|
3249
|
+
export declare class ProjectionManager {
|
|
3131
3250
|
/**
|
|
3132
|
-
*
|
|
3251
|
+
* Event that fires when the {@link CameraProjection} changes.
|
|
3133
3252
|
*/
|
|
3134
|
-
|
|
3253
|
+
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3135
3254
|
/**
|
|
3136
|
-
*
|
|
3255
|
+
* Current projection mode of the camera.
|
|
3256
|
+
* Default is "Perspective".
|
|
3137
3257
|
*/
|
|
3138
|
-
|
|
3258
|
+
current: CameraProjection;
|
|
3139
3259
|
/**
|
|
3140
|
-
* The
|
|
3260
|
+
* The camera controlled by this ProjectionManager.
|
|
3261
|
+
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3141
3262
|
*/
|
|
3142
|
-
camera:
|
|
3263
|
+
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3264
|
+
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3265
|
+
matchOrthoDistanceEnabled: boolean;
|
|
3266
|
+
private _component;
|
|
3267
|
+
private _previousDistance;
|
|
3268
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3143
3269
|
/**
|
|
3144
|
-
*
|
|
3270
|
+
* Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3271
|
+
*
|
|
3272
|
+
* @param projection - the new projection to set. If it is the current projection,
|
|
3273
|
+
* it will have no effect.
|
|
3274
|
+
*/
|
|
3275
|
+
set(projection: CameraProjection): Promise<void>;
|
|
3276
|
+
/**
|
|
3277
|
+
* Changes the current {@link CameraProjection} from Ortographic to Perspective
|
|
3278
|
+
* and vice versa.
|
|
3279
|
+
*/
|
|
3280
|
+
toggle(): Promise<void>;
|
|
3281
|
+
private setOrthoCamera;
|
|
3282
|
+
private getPerspectiveDims;
|
|
3283
|
+
private setupOrthoCamera;
|
|
3284
|
+
private getDistance;
|
|
3285
|
+
private setPerspectiveCamera;
|
|
3286
|
+
}
|
|
3287
|
+
import * as THREE from "three";
|
|
3288
|
+
import { Disposable, Event } from "../../Types";
|
|
3289
|
+
/**
|
|
3290
|
+
* A helper to easily get the real position of the mouse in the Three.js canvas to work with tools like the [raycaster](https://threejs.org/docs/#api/en/core/Raycaster), even if it has been transformed through CSS or doesn't occupy the whole screen.
|
|
3291
|
+
*/
|
|
3292
|
+
export declare class Mouse implements Disposable {
|
|
3293
|
+
dom: HTMLCanvasElement;
|
|
3294
|
+
private _event?;
|
|
3295
|
+
private _position;
|
|
3296
|
+
/** {@link Disposable.onDisposed} */
|
|
3297
|
+
readonly onDisposed: Event<unknown>;
|
|
3298
|
+
constructor(dom: HTMLCanvasElement);
|
|
3299
|
+
/**
|
|
3300
|
+
* The real position of the mouse of the Three.js canvas.
|
|
3301
|
+
*/
|
|
3302
|
+
get position(): THREE.Vector2;
|
|
3303
|
+
/** {@link Disposable.dispose} */
|
|
3304
|
+
dispose(): void;
|
|
3305
|
+
private getPositionY;
|
|
3306
|
+
private getPositionX;
|
|
3307
|
+
private updateMouseInfo;
|
|
3308
|
+
private setupEvents;
|
|
3309
|
+
}
|
|
3310
|
+
import * as THREE from "three";
|
|
3311
|
+
import { Components } from "../../Components";
|
|
3312
|
+
import { Event, World, Disposable } from "../../Types";
|
|
3313
|
+
import { Mouse } from "./mouse";
|
|
3314
|
+
/**
|
|
3315
|
+
* A simple [raycaster](https://threejs.org/docs/#api/en/core/Raycaster) that allows to easily get items from the scene using the mouse and touch events.
|
|
3316
|
+
*/
|
|
3317
|
+
export declare class SimpleRaycaster implements Disposable {
|
|
3318
|
+
/** {@link Component.enabled} */
|
|
3319
|
+
enabled: boolean;
|
|
3320
|
+
/** The components instance to which this Raycaster belongs. */
|
|
3321
|
+
components: Components;
|
|
3322
|
+
/** {@link Disposable.onDisposed} */
|
|
3323
|
+
readonly onDisposed: Event<unknown>;
|
|
3324
|
+
/** The position of the mouse in the screen. */
|
|
3325
|
+
readonly mouse: Mouse;
|
|
3326
|
+
/**
|
|
3327
|
+
* A reference to the Three.js Raycaster instance.
|
|
3328
|
+
* This is used for raycasting operations.
|
|
3329
|
+
*/
|
|
3330
|
+
readonly three: THREE.Raycaster;
|
|
3331
|
+
/**
|
|
3332
|
+
* A reference to the world instance to which this Raycaster belongs.
|
|
3333
|
+
* This is used to access the camera and meshes.
|
|
3145
3334
|
*/
|
|
3146
|
-
|
|
3335
|
+
world: World;
|
|
3336
|
+
constructor(components: Components, world: World);
|
|
3337
|
+
/** {@link Disposable.dispose} */
|
|
3338
|
+
dispose(): void;
|
|
3147
3339
|
/**
|
|
3148
|
-
*
|
|
3340
|
+
* Throws a ray from the camera to the mouse or touch event point and returns
|
|
3341
|
+
* the first item found. This also takes into account the clipping planes
|
|
3342
|
+
* used by the renderer.
|
|
3343
|
+
*
|
|
3344
|
+
* @param items - the [meshes](https://threejs.org/docs/#api/en/objects/Mesh)
|
|
3345
|
+
* to query. If not provided, it will query all the meshes stored in
|
|
3346
|
+
* {@link Components.meshes}.
|
|
3149
3347
|
*/
|
|
3150
|
-
|
|
3348
|
+
castRay(items?: THREE.Object3D[]): THREE.Intersection | null;
|
|
3151
3349
|
/**
|
|
3152
|
-
*
|
|
3350
|
+
* Casts a ray from a given origin in a given direction and returns the first item found.
|
|
3351
|
+
* This method also takes into account the clipping planes used by the renderer.
|
|
3352
|
+
*
|
|
3353
|
+
* @param origin - The origin of the ray.
|
|
3354
|
+
* @param direction - The direction of the ray.
|
|
3355
|
+
* @param items - The meshes to query. If not provided, it will query all the meshes stored in {@link World.meshes}.
|
|
3356
|
+
* @returns The first intersection found or 'null' if no intersection was found.
|
|
3153
3357
|
*/
|
|
3154
|
-
|
|
3358
|
+
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;
|
|
3359
|
+
private intersect;
|
|
3360
|
+
private filterClippingPlanes;
|
|
3361
|
+
}
|
|
3362
|
+
import { NavigationMode } from "./types";
|
|
3363
|
+
import { OrthoPerspectiveCamera } from "../index";
|
|
3364
|
+
/**
|
|
3365
|
+
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3366
|
+
*/
|
|
3367
|
+
export declare class PlanMode implements NavigationMode {
|
|
3368
|
+
private camera;
|
|
3369
|
+
/** {@link NavigationMode.enabled} */
|
|
3370
|
+
enabled: boolean;
|
|
3371
|
+
/** {@link NavigationMode.id} */
|
|
3372
|
+
readonly id = "Plan";
|
|
3373
|
+
private mouseAction1?;
|
|
3374
|
+
private mouseAction2?;
|
|
3375
|
+
private mouseInitialized;
|
|
3376
|
+
private readonly defaultAzimuthSpeed;
|
|
3377
|
+
private readonly defaultPolarSpeed;
|
|
3378
|
+
constructor(camera: OrthoPerspectiveCamera);
|
|
3379
|
+
/** {@link NavigationMode.set} */
|
|
3380
|
+
set(active: boolean): void;
|
|
3155
3381
|
}
|
|
3156
3382
|
import * as THREE from "three";
|
|
3157
3383
|
import { Hideable, Disposable, Event, World } from "../../Types";
|
|
@@ -3250,215 +3476,6 @@ export declare class SimplePlane implements Disposable, Hideable {
|
|
|
3250
3476
|
private newHelper;
|
|
3251
3477
|
private static newPlaneMesh;
|
|
3252
3478
|
}
|
|
3253
|
-
import { NavigationMode } from "./types";
|
|
3254
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3255
|
-
/**
|
|
3256
|
-
* A {@link NavigationMode} that allows first person navigation, simulating FPS video games.
|
|
3257
|
-
*/
|
|
3258
|
-
export declare class FirstPersonMode implements NavigationMode {
|
|
3259
|
-
private camera;
|
|
3260
|
-
/** {@link NavigationMode.enabled} */
|
|
3261
|
-
enabled: boolean;
|
|
3262
|
-
/** {@link NavigationMode.id} */
|
|
3263
|
-
readonly id = "FirstPerson";
|
|
3264
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3265
|
-
/** {@link NavigationMode.set} */
|
|
3266
|
-
set(active: boolean): void;
|
|
3267
|
-
private setupFirstPersonCamera;
|
|
3268
|
-
}
|
|
3269
|
-
import { NavigationMode } from "./types";
|
|
3270
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3271
|
-
/**
|
|
3272
|
-
* A {@link NavigationMode} that allows 3D navigation and panning like in many 3D and CAD softwares.
|
|
3273
|
-
*/
|
|
3274
|
-
export declare class OrbitMode implements NavigationMode {
|
|
3275
|
-
camera: OrthoPerspectiveCamera;
|
|
3276
|
-
/** {@link NavigationMode.enabled} */
|
|
3277
|
-
enabled: boolean;
|
|
3278
|
-
/** {@link NavigationMode.id} */
|
|
3279
|
-
readonly id = "Orbit";
|
|
3280
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3281
|
-
/** {@link NavigationMode.set} */
|
|
3282
|
-
set(active: boolean): void;
|
|
3283
|
-
private activateOrbitControls;
|
|
3284
|
-
}
|
|
3285
|
-
import { NavigationMode } from "./types";
|
|
3286
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3287
|
-
/**
|
|
3288
|
-
* A {@link NavigationMode} that allows to navigate floorplans in 2D, like many BIM tools.
|
|
3289
|
-
*/
|
|
3290
|
-
export declare class PlanMode implements NavigationMode {
|
|
3291
|
-
private camera;
|
|
3292
|
-
/** {@link NavigationMode.enabled} */
|
|
3293
|
-
enabled: boolean;
|
|
3294
|
-
/** {@link NavigationMode.id} */
|
|
3295
|
-
readonly id = "Plan";
|
|
3296
|
-
private mouseAction1?;
|
|
3297
|
-
private mouseAction2?;
|
|
3298
|
-
private mouseInitialized;
|
|
3299
|
-
private readonly defaultAzimuthSpeed;
|
|
3300
|
-
private readonly defaultPolarSpeed;
|
|
3301
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3302
|
-
/** {@link NavigationMode.set} */
|
|
3303
|
-
set(active: boolean): void;
|
|
3304
|
-
}
|
|
3305
|
-
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3306
|
-
/**
|
|
3307
|
-
* Settings for streaming properties. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3308
|
-
*/
|
|
3309
|
-
export declare class PropertiesStreamingSettings extends IfcFragmentSettings {
|
|
3310
|
-
/**
|
|
3311
|
-
* Amount of properties to be streamed.
|
|
3312
|
-
* Defaults to 100 properties.
|
|
3313
|
-
*/
|
|
3314
|
-
propertiesSize: number;
|
|
3315
|
-
}
|
|
3316
|
-
import * as THREE from "three";
|
|
3317
|
-
import { CameraProjection } from "./types";
|
|
3318
|
-
import { Event } from "../../Types";
|
|
3319
|
-
import { OrthoPerspectiveCamera } from "../index";
|
|
3320
|
-
/**
|
|
3321
|
-
* Object to control the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3322
|
-
*/
|
|
3323
|
-
export declare class ProjectionManager {
|
|
3324
|
-
/**
|
|
3325
|
-
* Event that fires when the {@link CameraProjection} changes.
|
|
3326
|
-
*/
|
|
3327
|
-
readonly onChanged: Event<THREE.PerspectiveCamera | THREE.OrthographicCamera>;
|
|
3328
|
-
/**
|
|
3329
|
-
* Current projection mode of the camera.
|
|
3330
|
-
* Default is "Perspective".
|
|
3331
|
-
*/
|
|
3332
|
-
current: CameraProjection;
|
|
3333
|
-
/**
|
|
3334
|
-
* The camera controlled by this ProjectionManager.
|
|
3335
|
-
* It can be either a PerspectiveCamera or an OrthographicCamera.
|
|
3336
|
-
*/
|
|
3337
|
-
camera: THREE.PerspectiveCamera | THREE.OrthographicCamera;
|
|
3338
|
-
/** Match Ortho zoom with Perspective distance when changing projection mode */
|
|
3339
|
-
matchOrthoDistanceEnabled: boolean;
|
|
3340
|
-
private _component;
|
|
3341
|
-
private _previousDistance;
|
|
3342
|
-
constructor(camera: OrthoPerspectiveCamera);
|
|
3343
|
-
/**
|
|
3344
|
-
* Sets the {@link CameraProjection} of the {@link OrthoPerspectiveCamera}.
|
|
3345
|
-
*
|
|
3346
|
-
* @param projection - the new projection to set. If it is the current projection,
|
|
3347
|
-
* it will have no effect.
|
|
3348
|
-
*/
|
|
3349
|
-
set(projection: CameraProjection): Promise<void>;
|
|
3350
|
-
/**
|
|
3351
|
-
* Changes the current {@link CameraProjection} from Ortographic to Perspective
|
|
3352
|
-
* and vice versa.
|
|
3353
|
-
*/
|
|
3354
|
-
toggle(): Promise<void>;
|
|
3355
|
-
private setOrthoCamera;
|
|
3356
|
-
private getPerspectiveDims;
|
|
3357
|
-
private setupOrthoCamera;
|
|
3358
|
-
private getDistance;
|
|
3359
|
-
private setPerspectiveCamera;
|
|
3360
|
-
}
|
|
3361
|
-
/**
|
|
3362
|
-
* The projection system of the camera.
|
|
3363
|
-
*/
|
|
3364
|
-
export type CameraProjection = "Perspective" | "Orthographic";
|
|
3365
|
-
/**
|
|
3366
|
-
* The extensible list of supported navigation modes.
|
|
3367
|
-
*/
|
|
3368
|
-
export type NavModeID = "Orbit" | "FirstPerson" | "Plan";
|
|
3369
|
-
/**
|
|
3370
|
-
* An object that determines the behavior of the camera controls and the user input (e.g. 2D floor plan mode, first person mode, etc).
|
|
3371
|
-
*/
|
|
3372
|
-
export interface NavigationMode {
|
|
3373
|
-
/** The unique ID of this navigation mode. */
|
|
3374
|
-
id: NavModeID;
|
|
3375
|
-
/**
|
|
3376
|
-
* Enable or disable this navigation mode.
|
|
3377
|
-
* When a new navigation mode is enabled, the previous navigation mode
|
|
3378
|
-
* must be disabled.
|
|
3379
|
-
*
|
|
3380
|
-
* @param active - whether to enable or disable this mode.
|
|
3381
|
-
* @param options - any additional data required to enable or disable it.
|
|
3382
|
-
* */
|
|
3383
|
-
set: (active: boolean, options?: any) => void;
|
|
3384
|
-
/** Whether this navigation mode is active or not. */
|
|
3385
|
-
enabled: boolean;
|
|
3386
|
-
}
|
|
3387
|
-
import * as WEBIFC from "web-ifc";
|
|
3388
|
-
export declare class IfcMetadataReader {
|
|
3389
|
-
getNameInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3390
|
-
getDescriptionInfo(webIfc: WEBIFC.IfcAPI): Record<string, any>;
|
|
3391
|
-
}
|
|
3392
|
-
import * as THREE from "three";
|
|
3393
|
-
import * as WEBIFC from "web-ifc";
|
|
3394
|
-
import * as FRAGS from "@thatopen/fragments";
|
|
3395
|
-
export declare class CivilReader {
|
|
3396
|
-
defLineMat: THREE.LineBasicMaterial;
|
|
3397
|
-
read(webIfc: WEBIFC.IfcAPI): {
|
|
3398
|
-
alignments: Map<number, FRAGS.Alignment>;
|
|
3399
|
-
coordinationMatrix: THREE.Matrix4;
|
|
3400
|
-
} | undefined;
|
|
3401
|
-
get(civilItems: any): {
|
|
3402
|
-
alignments: Map<number, FRAGS.Alignment>;
|
|
3403
|
-
coordinationMatrix: THREE.Matrix4;
|
|
3404
|
-
} | undefined;
|
|
3405
|
-
private getCurves;
|
|
3406
|
-
}
|
|
3407
|
-
import { IfcFragmentSettings } from "../../IfcLoader/src";
|
|
3408
|
-
/**
|
|
3409
|
-
* Settings for streaming IFC geometry and assets. Extends {@link IfcFragmentSettings} to inherit common settings.
|
|
3410
|
-
*/
|
|
3411
|
-
export declare class IfcStreamingSettings extends IfcFragmentSettings {
|
|
3412
|
-
/**
|
|
3413
|
-
* Minimum number of geometries to be streamed.
|
|
3414
|
-
* Defaults to 10 geometries.
|
|
3415
|
-
*/
|
|
3416
|
-
minGeometrySize: number;
|
|
3417
|
-
/**
|
|
3418
|
-
* Minimum amount of assets to be streamed.
|
|
3419
|
-
* Defaults to 1000 assets.
|
|
3420
|
-
*/
|
|
3421
|
-
minAssetsSize: number;
|
|
3422
|
-
}
|
|
3423
|
-
import * as WEBIFC from "web-ifc";
|
|
3424
|
-
import * as THREE from "three";
|
|
3425
|
-
export declare class Units {
|
|
3426
|
-
factor: number;
|
|
3427
|
-
complement: number;
|
|
3428
|
-
apply(matrix: THREE.Matrix4): void;
|
|
3429
|
-
setUp(webIfc: WEBIFC.IfcAPI): void;
|
|
3430
|
-
private getLengthUnits;
|
|
3431
|
-
private getScaleMatrix;
|
|
3432
|
-
}
|
|
3433
|
-
/**
|
|
3434
|
-
* A dictionary of geometries streamed from a server. Each geometry is identified by a unique number (id), and contains information about its bounding box, whether it has holes, and an optional file path for the geometry data.
|
|
3435
|
-
*/
|
|
3436
|
-
export interface StreamedGeometries {
|
|
3437
|
-
[id: number]: {
|
|
3438
|
-
/** The bounding box of the geometry as a Float32Array. */
|
|
3439
|
-
boundingBox: Float32Array;
|
|
3440
|
-
/** A boolean indicating whether the geometry has holes. */
|
|
3441
|
-
hasHoles: boolean;
|
|
3442
|
-
/** An optional file path for the geometry data. */
|
|
3443
|
-
geometryFile?: string;
|
|
3444
|
-
};
|
|
3445
|
-
}
|
|
3446
|
-
/**
|
|
3447
|
-
* A streamed asset, which consists of multiple geometries. Each geometry in the asset is identified by a unique number (geometryID), and contains information about its transformation and color.
|
|
3448
|
-
*/
|
|
3449
|
-
export interface StreamedAsset {
|
|
3450
|
-
/** The unique identifier of the asset. */
|
|
3451
|
-
id: number;
|
|
3452
|
-
/** An array of geometries associated with the asset. */
|
|
3453
|
-
geometries: {
|
|
3454
|
-
/** The unique identifier of the geometry. */
|
|
3455
|
-
geometryID: number;
|
|
3456
|
-
/** The transformation matrix of the geometry as a number array. */
|
|
3457
|
-
transformation: number[];
|
|
3458
|
-
/** The color of the geometry as a number array. */
|
|
3459
|
-
color: number[];
|
|
3460
|
-
}[];
|
|
3461
|
-
}
|
|
3462
3479
|
export type RelationsMap = Map<number, Map<number, number[]>>;
|
|
3463
3480
|
export interface ModelsRelationMap {
|
|
3464
3481
|
[modelID: string]: RelationsMap;
|