@thatopen/components 2.1.0 → 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 +83 -44
- package/dist/namespace.d.ts +2176 -2155
- package/dist/utils/vertex-picker.d.ts +4 -0
- package/package.json +56 -56
package/dist/index.mjs
CHANGED
|
@@ -2731,6 +2731,10 @@ class ea extends et {
|
|
|
2731
2731
|
* The event passes a THREE.Vector3 representing the position of the lost vertex.
|
|
2732
2732
|
*/
|
|
2733
2733
|
I(this, "onVertexLost", new D());
|
|
2734
|
+
/**
|
|
2735
|
+
* An event that is triggered when the picker is enabled or disabled
|
|
2736
|
+
*/
|
|
2737
|
+
I(this, "onEnabled", new D());
|
|
2734
2738
|
/**
|
|
2735
2739
|
* A reference to the Components instance associated with this VertexPicker.
|
|
2736
2740
|
*/
|
|
@@ -2758,7 +2762,7 @@ class ea extends et {
|
|
|
2758
2762
|
* @param value - The new enabled state.
|
|
2759
2763
|
*/
|
|
2760
2764
|
set enabled(t) {
|
|
2761
|
-
this._enabled = t, t || (this._pickedPoint = null);
|
|
2765
|
+
this._enabled = t, t || (this._pickedPoint = null), this.onEnabled.trigger(t);
|
|
2762
2766
|
}
|
|
2763
2767
|
/**
|
|
2764
2768
|
* Gets the current enabled state of the VertexPicker.
|
|
@@ -2964,7 +2968,7 @@ const Fs = class Fs {
|
|
|
2964
2968
|
/**
|
|
2965
2969
|
* The version of the @thatopen/components library.
|
|
2966
2970
|
*/
|
|
2967
|
-
I(Fs, "release", "2.1.
|
|
2971
|
+
I(Fs, "release", "2.1.2");
|
|
2968
2972
|
let pi = Fs;
|
|
2969
2973
|
class Rr {
|
|
2970
2974
|
constructor(s) {
|
|
@@ -7141,6 +7145,30 @@ const Xr = /* @__PURE__ */ new Map([
|
|
|
7141
7145
|
dispose() {
|
|
7142
7146
|
this.relationMaps = {}, this.components.get(ht).onFragmentsDisposed.remove(this.onFragmentsDisposed), this.onDisposed.trigger(Ye.uuid), this.onDisposed.reset();
|
|
7143
7147
|
}
|
|
7148
|
+
/**
|
|
7149
|
+
* 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.
|
|
7150
|
+
*
|
|
7151
|
+
* @param model The BIM model whose children to get.
|
|
7152
|
+
* @param id The expressID of the item whose children to get.
|
|
7153
|
+
* @param found An optional parameter that includes a set of expressIDs where the found element IDs will be added.
|
|
7154
|
+
*
|
|
7155
|
+
* @returns A `Set` with the expressIDs of the found items.
|
|
7156
|
+
*/
|
|
7157
|
+
getElementsChildren(t, e, i = /* @__PURE__ */ new Set()) {
|
|
7158
|
+
if (i.add(e), this.relationMaps[t.uuid] === void 0)
|
|
7159
|
+
throw new Error(
|
|
7160
|
+
"The provided model has no indices. You have to generate them first."
|
|
7161
|
+
);
|
|
7162
|
+
const n = this.getEntityRelations(t, e, "IsDecomposedBy");
|
|
7163
|
+
if (n)
|
|
7164
|
+
for (const a of n)
|
|
7165
|
+
this.getElementsChildren(t, a, i);
|
|
7166
|
+
const r = this.getEntityRelations(t, e, "ContainsElements");
|
|
7167
|
+
if (r)
|
|
7168
|
+
for (const a of r)
|
|
7169
|
+
this.getElementsChildren(t, a, i);
|
|
7170
|
+
return i;
|
|
7171
|
+
}
|
|
7144
7172
|
};
|
|
7145
7173
|
/**
|
|
7146
7174
|
* A unique identifier for the component.
|
|
@@ -10067,7 +10095,7 @@ const Ls = class Ls extends et {
|
|
|
10067
10095
|
for (const a of r) {
|
|
10068
10096
|
const c = n[a];
|
|
10069
10097
|
for (const h of i)
|
|
10070
|
-
delete c[h];
|
|
10098
|
+
delete c.map[h];
|
|
10071
10099
|
Object.values(c).length === 0 && delete n[a];
|
|
10072
10100
|
}
|
|
10073
10101
|
}
|
|
@@ -10089,7 +10117,7 @@ const Ls = class Ls extends et {
|
|
|
10089
10117
|
const i = this.list[e];
|
|
10090
10118
|
for (const o in i) {
|
|
10091
10119
|
const n = i[o];
|
|
10092
|
-
delete n[t];
|
|
10120
|
+
delete n.map[t];
|
|
10093
10121
|
}
|
|
10094
10122
|
}
|
|
10095
10123
|
}
|
|
@@ -10124,9 +10152,9 @@ const Ls = class Ls extends et {
|
|
|
10124
10152
|
for (const c of a) {
|
|
10125
10153
|
const h = this.list[r][c];
|
|
10126
10154
|
if (h)
|
|
10127
|
-
for (const d in h) {
|
|
10155
|
+
for (const d in h.map) {
|
|
10128
10156
|
o[d] || (o[d] = /* @__PURE__ */ new Map());
|
|
10129
|
-
for (const E of h[d]) {
|
|
10157
|
+
for (const E of h.map[d]) {
|
|
10130
10158
|
const u = o[d].get(E);
|
|
10131
10159
|
u === void 0 ? o[d].set(E, 1) : o[d].set(E, u + 1);
|
|
10132
10160
|
}
|
|
@@ -10160,13 +10188,13 @@ const Ls = class Ls extends et {
|
|
|
10160
10188
|
byModel(t, e) {
|
|
10161
10189
|
this.list.models || (this.list.models = {});
|
|
10162
10190
|
const i = this.list.models;
|
|
10163
|
-
i[t] || (i[t] = {});
|
|
10191
|
+
i[t] || (i[t] = { map: {}, id: null, name: t });
|
|
10164
10192
|
const o = i[t];
|
|
10165
10193
|
for (const [n, r] of e.data) {
|
|
10166
10194
|
const a = r[0];
|
|
10167
10195
|
for (const c of a) {
|
|
10168
10196
|
const h = e.keyFragments.get(c);
|
|
10169
|
-
h && (o[h] || (o[h] = /* @__PURE__ */ new Set()), o[h].add(n));
|
|
10197
|
+
h && (o.map[h] || (o.map[h] = /* @__PURE__ */ new Set()), o.map[h].add(n));
|
|
10170
10198
|
}
|
|
10171
10199
|
}
|
|
10172
10200
|
}
|
|
@@ -10192,7 +10220,11 @@ const Ls = class Ls extends et {
|
|
|
10192
10220
|
if (!r)
|
|
10193
10221
|
continue;
|
|
10194
10222
|
const a = String((o = r.PredefinedType) == null ? void 0 : o.value).toUpperCase();
|
|
10195
|
-
e[a] || (e[a] = {
|
|
10223
|
+
e[a] || (e[a] = {
|
|
10224
|
+
map: {},
|
|
10225
|
+
id: null,
|
|
10226
|
+
name: a
|
|
10227
|
+
});
|
|
10196
10228
|
const c = e[a];
|
|
10197
10229
|
for (const [h, d] of t.data) {
|
|
10198
10230
|
const E = d[0];
|
|
@@ -10200,7 +10232,7 @@ const Ls = class Ls extends et {
|
|
|
10200
10232
|
const f = t.keyFragments.get(u);
|
|
10201
10233
|
if (!f)
|
|
10202
10234
|
throw new Error("Fragment ID not found!");
|
|
10203
|
-
c[f] || (c[f] = /* @__PURE__ */ new Set()), c[f].add(r.expressID);
|
|
10235
|
+
c.map[f] || (c.map[f] = /* @__PURE__ */ new Set()), c.map[f].add(r.expressID);
|
|
10204
10236
|
}
|
|
10205
10237
|
}
|
|
10206
10238
|
}
|
|
@@ -10263,6 +10295,7 @@ const Ls = class Ls extends et {
|
|
|
10263
10295
|
* Classifies fragments based on their spatial structure in the IFC model.
|
|
10264
10296
|
*
|
|
10265
10297
|
* @param model - The FragmentsGroup containing the fragments to be classified.
|
|
10298
|
+
* @param config - The configuration for the classifier. It includes "useProperties" (if false, the classification will use the expressIDs instead of the names)
|
|
10266
10299
|
*
|
|
10267
10300
|
* @remarks
|
|
10268
10301
|
* This method iterates through the relations of the fragments in the provided group,
|
|
@@ -10272,49 +10305,55 @@ const Ls = class Ls extends et {
|
|
|
10272
10305
|
*
|
|
10273
10306
|
* @throws Will throw an error if the fragment ID is not found or if the model relations do not exist.
|
|
10274
10307
|
*/
|
|
10275
|
-
async bySpatialStructure(t) {
|
|
10276
|
-
var
|
|
10277
|
-
const
|
|
10278
|
-
if (!
|
|
10308
|
+
async bySpatialStructure(t, e = { useProperties: !0 }) {
|
|
10309
|
+
var r, a;
|
|
10310
|
+
const i = this.components.get(ke), o = i.relationMaps[t.uuid];
|
|
10311
|
+
if (!o)
|
|
10279
10312
|
throw new Error(
|
|
10280
10313
|
`Classifier: model relations of ${t.name || t.uuid} have to exists to group by spatial structure.`
|
|
10281
10314
|
);
|
|
10282
|
-
const
|
|
10283
|
-
for (const [
|
|
10284
|
-
const
|
|
10315
|
+
const n = "spatialStructures";
|
|
10316
|
+
for (const [c] of o) {
|
|
10317
|
+
const h = i.getEntityRelations(
|
|
10285
10318
|
t,
|
|
10286
|
-
|
|
10319
|
+
c,
|
|
10287
10320
|
"Decomposes"
|
|
10288
10321
|
);
|
|
10289
|
-
if (
|
|
10290
|
-
for (const u of
|
|
10291
|
-
|
|
10292
|
-
if (
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10322
|
+
if (h)
|
|
10323
|
+
for (const u of h) {
|
|
10324
|
+
let f = u.toString();
|
|
10325
|
+
if (e.useProperties) {
|
|
10326
|
+
const R = await t.getProperties(u);
|
|
10327
|
+
if (!R)
|
|
10328
|
+
continue;
|
|
10329
|
+
f = (r = R.Name) == null ? void 0 : r.value;
|
|
10330
|
+
}
|
|
10331
|
+
this.saveItem(t, n, f, c, u);
|
|
10296
10332
|
}
|
|
10297
|
-
const
|
|
10333
|
+
const d = i.getEntityRelations(
|
|
10298
10334
|
t,
|
|
10299
|
-
|
|
10335
|
+
c,
|
|
10300
10336
|
"ContainsElements"
|
|
10301
10337
|
);
|
|
10302
|
-
if (!h)
|
|
10303
|
-
continue;
|
|
10304
|
-
const d = await t.getProperties(a);
|
|
10305
10338
|
if (!d)
|
|
10306
10339
|
continue;
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10340
|
+
let E = c.toString();
|
|
10341
|
+
if (e.useProperties) {
|
|
10342
|
+
const u = await t.getProperties(c);
|
|
10343
|
+
if (!u)
|
|
10344
|
+
continue;
|
|
10345
|
+
E = (a = u.Name) == null ? void 0 : a.value;
|
|
10346
|
+
}
|
|
10347
|
+
for (const u of d) {
|
|
10348
|
+
this.saveItem(t, n, E, u, c);
|
|
10349
|
+
const f = i.getEntityRelations(
|
|
10311
10350
|
t,
|
|
10312
10351
|
Number(u),
|
|
10313
10352
|
"IsDecomposedBy"
|
|
10314
10353
|
);
|
|
10315
10354
|
if (f)
|
|
10316
10355
|
for (const R of f)
|
|
10317
|
-
this.saveItem(t,
|
|
10356
|
+
this.saveItem(t, n, E, R, c);
|
|
10318
10357
|
}
|
|
10319
10358
|
}
|
|
10320
10359
|
}
|
|
@@ -10362,15 +10401,15 @@ const Ls = class Ls extends et {
|
|
|
10362
10401
|
o.resetColor(n);
|
|
10363
10402
|
}
|
|
10364
10403
|
}
|
|
10365
|
-
saveItem(t, e, i, o) {
|
|
10404
|
+
saveItem(t, e, i, o, n = null) {
|
|
10366
10405
|
this.list[e] || (this.list[e] = {});
|
|
10367
|
-
const
|
|
10368
|
-
if (
|
|
10369
|
-
for (const
|
|
10370
|
-
const
|
|
10371
|
-
if (
|
|
10372
|
-
const
|
|
10373
|
-
|
|
10406
|
+
const r = t.data.get(o);
|
|
10407
|
+
if (r)
|
|
10408
|
+
for (const a of r[0]) {
|
|
10409
|
+
const c = t.keyFragments.get(a);
|
|
10410
|
+
if (c) {
|
|
10411
|
+
const h = this.list[e];
|
|
10412
|
+
h[i] || (h[i] = { map: {}, id: n, name: i }), h[i].map[c] || (h[i].map[c] = /* @__PURE__ */ new Set()), h[i].map[c].add(o);
|
|
10374
10413
|
}
|
|
10375
10414
|
}
|
|
10376
10415
|
}
|
|
@@ -10438,7 +10477,7 @@ const ys = class ys extends et {
|
|
|
10438
10477
|
if (!d || t && u || !t && !u)
|
|
10439
10478
|
continue;
|
|
10440
10479
|
t ? this.list.add(E) : this.list.delete(E);
|
|
10441
|
-
const f = r[c][h];
|
|
10480
|
+
const f = r[c].map[h];
|
|
10442
10481
|
d.applyTransform(f, a);
|
|
10443
10482
|
}
|
|
10444
10483
|
n++;
|