bimatter-viewer-react 0.5.11 → 0.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -0
- package/lib/api/ViewerApi.d.ts +4 -0
- package/lib/api/ViewerPropertiesApi.d.ts +4 -1
- package/lib/index.js +855 -740
- package/lib/utils/ColorsUtils/useElementColors.d.ts +4 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -12,33 +12,33 @@ var Te = t(null);
|
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/viewer/store/useViewerStore.ts
|
|
14
14
|
function z(e) {
|
|
15
|
-
return ge(
|
|
15
|
+
return ge(Ee(), e);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function Ee() {
|
|
18
18
|
let e = a(Te);
|
|
19
19
|
if (!e) throw Error("useViewerStore must be used inside ViewerStoreProvider");
|
|
20
20
|
return e;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/viewer/store/ViewerStore.ts
|
|
24
|
-
var
|
|
24
|
+
var De = "rgb(17, 148, 189)", Oe = "rgb(104, 198, 227)", ke = {
|
|
25
25
|
bottom: !0,
|
|
26
26
|
left: !0,
|
|
27
27
|
right: !0,
|
|
28
28
|
top: !0,
|
|
29
29
|
visible: !0
|
|
30
30
|
};
|
|
31
|
-
function
|
|
31
|
+
function Ae() {
|
|
32
32
|
return _e((e) => ({
|
|
33
33
|
api: null,
|
|
34
34
|
defaultHotkeysEnabled: !0,
|
|
35
|
-
gridAxesVisibility:
|
|
35
|
+
gridAxesVisibility: ke,
|
|
36
36
|
modelNames: {},
|
|
37
37
|
modelProps: {},
|
|
38
38
|
modelStructure: {},
|
|
39
|
-
preselectionColor:
|
|
39
|
+
preselectionColor: Oe,
|
|
40
40
|
selected: {},
|
|
41
|
-
selectionColor:
|
|
41
|
+
selectionColor: De,
|
|
42
42
|
selectionInteractionDisabled: !1,
|
|
43
43
|
showNavCube: !0,
|
|
44
44
|
showStats: !1,
|
|
@@ -119,60 +119,66 @@ function ke() {
|
|
|
119
119
|
}
|
|
120
120
|
}));
|
|
121
121
|
}
|
|
122
|
-
var
|
|
123
|
-
function
|
|
122
|
+
var je = 2;
|
|
123
|
+
function Me() {
|
|
124
124
|
let e = new C(new Uint8Array(256 * 4), 256, 1, le, he);
|
|
125
|
-
return e.magFilter = ie, e.minFilter = ie, e.generateMipmaps = !1, e.needsUpdate = !0,
|
|
125
|
+
return e.magFilter = ie, e.minFilter = ie, e.generateMipmaps = !1, e.needsUpdate = !0, Pe(e, 1, new x(De)), e;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function Ne(e) {
|
|
128
128
|
return `${e.r.toFixed(6)}:${e.g.toFixed(6)}:${e.b.toFixed(6)}`;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Pe(e, t, n) {
|
|
131
131
|
let r = e.image.data, i = t * 4;
|
|
132
132
|
r[i] = Math.round(n.r * 255), r[i + 1] = Math.round(n.g * 255), r[i + 2] = Math.round(n.b * 255), r[i + 3] = 255, e.needsUpdate = !0;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Fe(e) {
|
|
135
135
|
return e.mesh.geometry.attributes.colorIndex;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function Ie(e) {
|
|
138
138
|
let t = e.mesh.geometry.attributes.ids;
|
|
139
139
|
if (!t) return null;
|
|
140
140
|
let n = new v(new Uint8Array(t.count), 1);
|
|
141
141
|
return e.mesh.geometry.setAttribute("colorIndex", n), n;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
let n =
|
|
145
|
-
return n || t === 0 ? n :
|
|
143
|
+
function Le(e, t) {
|
|
144
|
+
let n = Fe(e);
|
|
145
|
+
return n || t === 0 ? n : Ie(e);
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
|
|
147
|
+
function Re(e) {
|
|
148
|
+
Fe(e) && e.mesh.geometry.deleteAttribute("colorIndex");
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function ze(e, t, n) {
|
|
151
151
|
let r = e.get(t);
|
|
152
152
|
return !r && n && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
let n =
|
|
154
|
+
function Be(e, t) {
|
|
155
|
+
let n = Le(e.record, t);
|
|
156
156
|
if (!n) return !1;
|
|
157
157
|
let r = n.array;
|
|
158
158
|
return e.vertexRanges.forEach(({ count: e, start: n }) => {
|
|
159
159
|
r.fill(t, n, n + e);
|
|
160
160
|
}), n.needsUpdate = !0, !0;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function Ve(e, t, n, r, i) {
|
|
163
163
|
e && e.forEach((e) => {
|
|
164
164
|
if (e.record.modelID !== t) return;
|
|
165
|
-
let a =
|
|
166
|
-
r === 0 ? (o?.delete(n), o?.size || (i.delete(e.record),
|
|
165
|
+
let a = Be(e, r), o = ze(i, e.record, r !== 0 && a);
|
|
166
|
+
r === 0 ? (o?.delete(n), o?.size || (i.delete(e.record), Re(e.record))) : a && o?.add(n);
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function He(e, t, n) {
|
|
170
|
+
let r = /* @__PURE__ */ new Set();
|
|
171
|
+
return e.elementIndex.forEach((e, i) => {
|
|
172
|
+
n.has(i) || e.some((e) => e.record.modelID === t) && r.add(i);
|
|
173
|
+
}), r;
|
|
174
|
+
}
|
|
175
|
+
function Ue(e) {
|
|
170
176
|
let t = /* @__PURE__ */ new Set();
|
|
171
177
|
return Object.entries(e).forEach(([e, n]) => {
|
|
172
178
|
n.forEach((n) => t.add(`${e}:${n}`));
|
|
173
179
|
}), t;
|
|
174
180
|
}
|
|
175
|
-
function
|
|
181
|
+
function We(e, t) {
|
|
176
182
|
let n = /* @__PURE__ */ new Map(), r = (e) => {
|
|
177
183
|
let [t, r] = e.split(":").map(Number), i = n.get(t);
|
|
178
184
|
i || (i = /* @__PURE__ */ new Set(), n.set(t, i)), i.add(r);
|
|
@@ -183,43 +189,54 @@ function He(e, t) {
|
|
|
183
189
|
t.has(e) || r(e);
|
|
184
190
|
}), n;
|
|
185
191
|
}
|
|
186
|
-
function
|
|
187
|
-
let t = z((e) => e.selected), n = z((e) => e.selectionColor), r = c(
|
|
192
|
+
function Ge(e) {
|
|
193
|
+
let t = z((e) => e.selected), n = z((e) => e.selectionColor), r = c(() => Me(), []), a = l(/* @__PURE__ */ new Map()), s = l(je), u = l(/* @__PURE__ */ new Map()), d = l(t), f = l(/* @__PURE__ */ new Set()), p = l(/* @__PURE__ */ new WeakMap());
|
|
188
194
|
o(() => {
|
|
189
195
|
d.current = t;
|
|
190
196
|
}, [t]), o(() => () => r.dispose(), [r]), o(() => {
|
|
191
|
-
|
|
197
|
+
Pe(r, 1, new x(n));
|
|
192
198
|
}, [r, n]);
|
|
193
199
|
let m = i((e, t) => d.current[e]?.has(t) ? 1 : u.current.get(e)?.get(t) ?? 0, []), h = i((t, n) => {
|
|
194
200
|
let r = e.buildIndex();
|
|
195
201
|
n.forEach((e) => {
|
|
196
|
-
|
|
202
|
+
Ve(r.elementIndex.get(e), t, e, m(t, e), p.current);
|
|
197
203
|
});
|
|
198
204
|
}, [e, m]), g = i((e) => {
|
|
199
|
-
let t = new x(e), n =
|
|
205
|
+
let t = new x(e), n = Ne(t), i = a.current.get(n);
|
|
200
206
|
if (i !== void 0) return i;
|
|
201
207
|
let o = s.current;
|
|
202
208
|
if (o >= 256) throw Error("Element color palette is full. Maximum colors: 255.");
|
|
203
|
-
return a.current.set(n, o), s.current += 1,
|
|
209
|
+
return a.current.set(n, o), s.current += 1, Pe(r, o, t), o;
|
|
204
210
|
}, [r]);
|
|
205
211
|
o(() => {
|
|
206
|
-
let e =
|
|
207
|
-
|
|
212
|
+
let e = Ue(t);
|
|
213
|
+
We(f.current, e).forEach((e, t) => {
|
|
208
214
|
h(t, Array.from(e));
|
|
209
215
|
}), f.current = e;
|
|
210
216
|
}, [h, t]);
|
|
211
217
|
let _ = i((e, t, n) => {
|
|
212
218
|
let r = g(n), i = u.current.get(e);
|
|
213
219
|
i || (i = /* @__PURE__ */ new Map(), u.current.set(e, i)), t.forEach((e) => i.set(e, r)), h(e, t);
|
|
214
|
-
}, [h, g]), v = i((
|
|
220
|
+
}, [h, g]), v = i((t, n, r) => {
|
|
221
|
+
let i = e.buildIndex(), a = /* @__PURE__ */ new Set(), o = Object.entries(n);
|
|
222
|
+
o.forEach(([, e]) => {
|
|
223
|
+
e.forEach((e) => a.add(e));
|
|
224
|
+
}), r !== void 0 && _(t, Array.from(He(i, t, a)), r), o.forEach(([e, n]) => {
|
|
225
|
+
_(t, n, e);
|
|
226
|
+
});
|
|
227
|
+
}, [e, _]), y = i((e, t) => {
|
|
228
|
+
Object.entries(e).forEach(([e, n]) => {
|
|
229
|
+
v(Number(e), n, t);
|
|
230
|
+
});
|
|
231
|
+
}, [v]), b = i((e, t) => {
|
|
215
232
|
let n = u.current.get(e);
|
|
216
233
|
t.forEach((e) => n?.delete(e)), n?.size === 0 && u.current.delete(e), h(e, t);
|
|
217
|
-
}, [h]),
|
|
234
|
+
}, [h]), S = i((e) => {
|
|
218
235
|
let t = u.current.get(e);
|
|
219
236
|
if (!t?.size) return;
|
|
220
237
|
let n = Array.from(t.keys());
|
|
221
238
|
t.clear(), u.current.delete(e), h(e, n);
|
|
222
|
-
}, [h]),
|
|
239
|
+
}, [h]), C = i(() => {
|
|
223
240
|
let t = e.buildIndex(), n = /* @__PURE__ */ new Map(), r = (e, t) => {
|
|
224
241
|
let r = n.get(e);
|
|
225
242
|
r || (r = /* @__PURE__ */ new Set(), n.set(e, r)), r.add(t);
|
|
@@ -232,27 +249,31 @@ function Ue(e) {
|
|
|
232
249
|
t.forEach((t) => r(Number(e), t));
|
|
233
250
|
}), n.forEach((e, n) => {
|
|
234
251
|
e.forEach((e) => {
|
|
235
|
-
|
|
252
|
+
Ve(t.elementIndex.get(e), n, e, m(n, e), p.current);
|
|
236
253
|
});
|
|
237
254
|
});
|
|
238
|
-
}, [e, m]),
|
|
255
|
+
}, [e, m]), w = i(() => {
|
|
239
256
|
e.buildIndex().records.forEach((e) => {
|
|
240
|
-
p.current.delete(e),
|
|
241
|
-
}), p.current = /* @__PURE__ */ new WeakMap(), u.current.clear(),
|
|
242
|
-
}, [
|
|
257
|
+
p.current.delete(e), Re(e);
|
|
258
|
+
}), p.current = /* @__PURE__ */ new WeakMap(), u.current.clear(), C();
|
|
259
|
+
}, [C, e]);
|
|
243
260
|
return {
|
|
244
261
|
colorPaletteTexture: r,
|
|
245
262
|
colorUtils: c(() => ({
|
|
246
|
-
applyStoredColors:
|
|
247
|
-
clearAllColors:
|
|
248
|
-
clearColor:
|
|
249
|
-
clearModelColors:
|
|
263
|
+
applyStoredColors: C,
|
|
264
|
+
clearAllColors: w,
|
|
265
|
+
clearColor: b,
|
|
266
|
+
clearModelColors: S,
|
|
267
|
+
rebuildByColors: y,
|
|
268
|
+
rebuildModelByColors: v,
|
|
250
269
|
setColor: _
|
|
251
270
|
}), [
|
|
271
|
+
C,
|
|
272
|
+
w,
|
|
252
273
|
b,
|
|
253
274
|
S,
|
|
254
|
-
v,
|
|
255
275
|
y,
|
|
276
|
+
v,
|
|
256
277
|
_
|
|
257
278
|
])
|
|
258
279
|
};
|
|
@@ -260,7 +281,7 @@ function Ue(e) {
|
|
|
260
281
|
//#endregion
|
|
261
282
|
//#region src/viewer/SelectableMesh.tsx
|
|
262
283
|
P.prototype.raycast = Se;
|
|
263
|
-
var
|
|
284
|
+
var Ke = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSpace: r = !1, meshMatrix: i }) {
|
|
264
285
|
let a = l(null), s = z((e) => e.preselectionColor), u = l(s);
|
|
265
286
|
u.current = s;
|
|
266
287
|
let d = c(() => {
|
|
@@ -331,12 +352,12 @@ var We = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSp
|
|
|
331
352
|
})
|
|
332
353
|
] }), /* @__PURE__ */ L("primitive", { object: d })]
|
|
333
354
|
});
|
|
334
|
-
}),
|
|
335
|
-
function
|
|
355
|
+
}), qe = 10, Je = "#1d2733", Ye = 2, Xe = .05, Ze = "\0", Qe = /* @__PURE__ */ new Map();
|
|
356
|
+
function $e() {
|
|
336
357
|
return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
|
|
337
358
|
}
|
|
338
|
-
function
|
|
339
|
-
let i =
|
|
359
|
+
function et(e, t, n, r) {
|
|
360
|
+
let i = $e(), a = document.createElement("canvas"), o = a.getContext("2d");
|
|
340
361
|
if (!o) throw Error("Could not create grid label canvas context");
|
|
341
362
|
let s = `400 ${r}px system-ui, "Segoe UI", sans-serif`, c = Math.ceil(r * .5), l = Math.ceil(r * .35);
|
|
342
363
|
o.font = s;
|
|
@@ -352,49 +373,49 @@ function Qe(e, t, n, r) {
|
|
|
352
373
|
width: p
|
|
353
374
|
};
|
|
354
375
|
}
|
|
355
|
-
function
|
|
376
|
+
function tt(e, t, n) {
|
|
356
377
|
let r = [
|
|
357
378
|
e,
|
|
358
379
|
t,
|
|
359
380
|
n
|
|
360
|
-
].join(
|
|
361
|
-
return i || (i =
|
|
381
|
+
].join(Ze), i = Qe.get(r);
|
|
382
|
+
return i || (i = et(r, e, t, n), Qe.set(r, i)), i;
|
|
362
383
|
}
|
|
363
|
-
function
|
|
364
|
-
let r = c(() =>
|
|
384
|
+
function nt(e, t, n) {
|
|
385
|
+
let r = c(() => tt(e, t, n), [
|
|
365
386
|
t,
|
|
366
387
|
n,
|
|
367
388
|
e
|
|
368
389
|
]);
|
|
369
390
|
return o(() => (r.disposeTimer &&= (clearTimeout(r.disposeTimer), null), r.refs++, () => {
|
|
370
391
|
r.refs = Math.max(0, r.refs - 1), r.refs <= 0 && (r.disposeTimer = setTimeout(() => {
|
|
371
|
-
r.refs > 0 || (r.texture.dispose(),
|
|
392
|
+
r.refs > 0 || (r.texture.dispose(), Qe.delete(r.key), r.disposeTimer = null);
|
|
372
393
|
}, 1e3));
|
|
373
394
|
}), [r]), r;
|
|
374
395
|
}
|
|
375
|
-
function
|
|
396
|
+
function rt(e, t, n, r) {
|
|
376
397
|
let i = Math.abs(n.projectionMatrix.elements[5]) || 1, a = t.height * 2 / (Math.max(1, r) * i), o = a * (t.width / t.height);
|
|
377
398
|
e.scale.set(o, a, 1);
|
|
378
399
|
}
|
|
379
|
-
function
|
|
400
|
+
function it(e, t) {
|
|
380
401
|
let n = e[t];
|
|
381
402
|
return n === void 0 ? 0 : Number.isFinite(n) ? n : null;
|
|
382
403
|
}
|
|
383
|
-
function
|
|
384
|
-
return
|
|
404
|
+
function B(e, t) {
|
|
405
|
+
return it(e, t) ?? 0;
|
|
385
406
|
}
|
|
386
|
-
function
|
|
387
|
-
let t =
|
|
407
|
+
function at(e) {
|
|
408
|
+
let t = it(e, "x"), n = it(e, "y"), r = it(e, "z");
|
|
388
409
|
return t === null || n === null || r === null ? null : new I(t, n, r);
|
|
389
410
|
}
|
|
390
|
-
function
|
|
411
|
+
function ot(e, t) {
|
|
391
412
|
return [
|
|
392
|
-
|
|
393
|
-
t !== void 0 && Number.isFinite(t) ? t :
|
|
394
|
-
|
|
413
|
+
B(e, "x"),
|
|
414
|
+
t !== void 0 && Number.isFinite(t) ? t : B(e, "y"),
|
|
415
|
+
B(e, "z")
|
|
395
416
|
];
|
|
396
417
|
}
|
|
397
|
-
function
|
|
418
|
+
function st(e) {
|
|
398
419
|
let { h: t, l: n } = e.getHSL({
|
|
399
420
|
h: 0,
|
|
400
421
|
s: 0,
|
|
@@ -402,14 +423,14 @@ function at(e) {
|
|
|
402
423
|
});
|
|
403
424
|
return t < .55 && n >= .5 || t >= .55 && n >= .75 ? "#000000" : "#ffffff";
|
|
404
425
|
}
|
|
405
|
-
function
|
|
426
|
+
function ct(e) {
|
|
406
427
|
let t = p((e) => e.scene.background);
|
|
407
|
-
return c(() => e || (t instanceof x ?
|
|
428
|
+
return c(() => e || (t instanceof x ? st(t) : Je), [t, e]);
|
|
408
429
|
}
|
|
409
|
-
function
|
|
430
|
+
function lt({ axis: e, grid: t, endSide: n, startSide: r }) {
|
|
410
431
|
return Object.entries(e).flatMap(([e, i]) => {
|
|
411
432
|
if (i.length < 2) return [];
|
|
412
|
-
let a =
|
|
433
|
+
let a = at(i[0]), o = at(i[1]);
|
|
413
434
|
return !a || !o ? [] : (a.y = 0, o.y = 0, [{
|
|
414
435
|
endSide: n,
|
|
415
436
|
loc: t.loc,
|
|
@@ -419,18 +440,18 @@ function st({ axis: e, grid: t, endSide: n, startSide: r }) {
|
|
|
419
440
|
}]);
|
|
420
441
|
});
|
|
421
442
|
}
|
|
422
|
-
function
|
|
443
|
+
function ut({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight: i, showTop: a }) {
|
|
423
444
|
let o = {
|
|
424
445
|
bottom: n,
|
|
425
446
|
left: r,
|
|
426
447
|
right: i,
|
|
427
448
|
top: a
|
|
428
|
-
}, s = Object.values(t).flatMap((e) => [...
|
|
449
|
+
}, s = Object.values(t).flatMap((e) => [...lt({
|
|
429
450
|
axis: e.points.u,
|
|
430
451
|
endSide: "right",
|
|
431
452
|
grid: e,
|
|
432
453
|
startSide: "left"
|
|
433
|
-
}), ...
|
|
454
|
+
}), ...lt({
|
|
434
455
|
axis: e.points.v,
|
|
435
456
|
endSide: "bottom",
|
|
436
457
|
grid: e,
|
|
@@ -443,8 +464,8 @@ function ct({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
|
|
|
443
464
|
e.startSide,
|
|
444
465
|
e.endSide,
|
|
445
466
|
e.name,
|
|
446
|
-
|
|
447
|
-
|
|
467
|
+
B(e.loc, "x"),
|
|
468
|
+
B(e.loc, "z"),
|
|
448
469
|
e.points[0].x,
|
|
449
470
|
e.points[0].z,
|
|
450
471
|
e.points[1].x,
|
|
@@ -453,52 +474,52 @@ function ct({ flattenToFloor: e, grids: t, showBottom: n, showLeft: r, showRight
|
|
|
453
474
|
c.has(t) || c.set(t, e);
|
|
454
475
|
}), Array.from(c.values());
|
|
455
476
|
}
|
|
456
|
-
function
|
|
457
|
-
return new I(...
|
|
477
|
+
function dt(e, t) {
|
|
478
|
+
return new I(...ot(e.loc, t));
|
|
458
479
|
}
|
|
459
|
-
function
|
|
480
|
+
function ft({ cameraPosition: e, floorY: t, line: n, showBottom: r, showLeft: i, showRight: a, showTop: o }) {
|
|
460
481
|
let s = {
|
|
461
482
|
bottom: r,
|
|
462
483
|
left: i,
|
|
463
484
|
right: a,
|
|
464
485
|
top: o
|
|
465
|
-
}, c =
|
|
486
|
+
}, c = dt(n, t), l = n.points[0].clone().add(c), u = n.points[1].clone().add(c), d = l.distanceToSquared(e) > u.distanceToSquared(e) ? "start" : "end", f = d === "start" ? "end" : "start", p = (e) => s[e === "start" ? n.startSide : n.endSide];
|
|
466
487
|
return p(d) ? d : p(f) ? f : null;
|
|
467
488
|
}
|
|
468
|
-
function
|
|
489
|
+
function pt({ endpoint: e, labelOffset: t, line: n }) {
|
|
469
490
|
let r = e === "start" ? n.points[0].clone() : n.points[1].clone(), i = n.points[1].clone().sub(n.points[0]);
|
|
470
491
|
return i.y = 0, i.lengthSq() === 0 && i.set(1, 0, 0), i.normalize().multiplyScalar(t), e === "start" && i.negate(), r.add(i);
|
|
471
492
|
}
|
|
472
|
-
function
|
|
493
|
+
function mt(e, t) {
|
|
473
494
|
let n = new I(), r = 0;
|
|
474
495
|
return e.forEach((e) => {
|
|
475
|
-
let i =
|
|
496
|
+
let i = dt(e, t);
|
|
476
497
|
e.points.forEach((e) => {
|
|
477
498
|
n.add(e).add(i), r++;
|
|
478
499
|
});
|
|
479
500
|
}), r && n.divideScalar(r), n;
|
|
480
501
|
}
|
|
481
|
-
function
|
|
502
|
+
function ht(e, t, n) {
|
|
482
503
|
let r = 0;
|
|
483
504
|
return e.forEach((e) => {
|
|
484
|
-
let i =
|
|
505
|
+
let i = dt(e, n);
|
|
485
506
|
e.points.forEach((e) => {
|
|
486
507
|
r = Math.max(r, e.clone().add(i).distanceTo(t));
|
|
487
508
|
});
|
|
488
509
|
}), r;
|
|
489
510
|
}
|
|
490
|
-
function
|
|
491
|
-
let { camera: i, size: a } = p(), s = l(null), c =
|
|
511
|
+
function gt({ color: e, fontSize: t, position: n, text: r }) {
|
|
512
|
+
let { camera: i, size: a } = p(), s = l(null), c = nt(r, e, t);
|
|
492
513
|
return o(() => {
|
|
493
514
|
let e = s.current;
|
|
494
|
-
e &&
|
|
515
|
+
e && rt(e, c, i, a.height);
|
|
495
516
|
}, [
|
|
496
517
|
i,
|
|
497
518
|
a.height,
|
|
498
519
|
c
|
|
499
520
|
]), f(({ camera: e, size: t }) => {
|
|
500
521
|
let n = s.current;
|
|
501
|
-
n &&
|
|
522
|
+
n && rt(n, c, e, t.height);
|
|
502
523
|
}), /* @__PURE__ */ L("sprite", {
|
|
503
524
|
ref: s,
|
|
504
525
|
position: n,
|
|
@@ -514,8 +535,8 @@ function mt({ color: e, fontSize: t, position: n, text: r }) {
|
|
|
514
535
|
})
|
|
515
536
|
});
|
|
516
537
|
}
|
|
517
|
-
function
|
|
518
|
-
let f = c(() => new y().setFromPoints(a.points), [a.points]), p =
|
|
538
|
+
function _t({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset: i, line: a, showBottom: s, showLeft: l, showRight: u, showTop: d }) {
|
|
539
|
+
let f = c(() => new y().setFromPoints(a.points), [a.points]), p = ft({
|
|
519
540
|
cameraPosition: e,
|
|
520
541
|
floorY: n,
|
|
521
542
|
line: a,
|
|
@@ -523,19 +544,19 @@ function ht({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
|
|
|
523
544
|
showLeft: l,
|
|
524
545
|
showRight: u,
|
|
525
546
|
showTop: d
|
|
526
|
-
}), m = p ?
|
|
547
|
+
}), m = p ? pt({
|
|
527
548
|
endpoint: p,
|
|
528
549
|
labelOffset: i,
|
|
529
550
|
line: a
|
|
530
551
|
}) : null;
|
|
531
552
|
return o(() => () => f.dispose(), [f]), /* @__PURE__ */ R("lineSegments", {
|
|
532
553
|
geometry: f,
|
|
533
|
-
position:
|
|
554
|
+
position: ot(a.loc, n),
|
|
534
555
|
children: [/* @__PURE__ */ L("lineBasicMaterial", {
|
|
535
556
|
color: t,
|
|
536
557
|
depthWrite: !1,
|
|
537
558
|
linewidth: 2
|
|
538
|
-
}), m && /* @__PURE__ */ L(
|
|
559
|
+
}), m && /* @__PURE__ */ L(gt, {
|
|
539
560
|
color: t,
|
|
540
561
|
fontSize: r,
|
|
541
562
|
position: m,
|
|
@@ -543,8 +564,8 @@ function ht({ cameraPosition: e, color: t, floorY: n, fontSize: r, labelOffset:
|
|
|
543
564
|
})]
|
|
544
565
|
});
|
|
545
566
|
}
|
|
546
|
-
function
|
|
547
|
-
let h = p((e) => e.camera), g = l(null), [_, v] = u(() => new I()), y =
|
|
567
|
+
function vt({ color: e, floorY: t, fontSize: n = qe, grids: r, labelOffset: i = Ye, showBottom: a = !0, showLeft: o = !0, showRight: s = !0, showTop: d = !0, visible: m = !0 }) {
|
|
568
|
+
let h = p((e) => e.camera), g = l(null), [_, v] = u(() => new I()), y = ct(e), b = c(() => r ? ut({
|
|
548
569
|
flattenToFloor: t !== void 0,
|
|
549
570
|
grids: r,
|
|
550
571
|
showBottom: a,
|
|
@@ -558,7 +579,7 @@ function gt({ color: e, floorY: t, fontSize: n = Ge, grids: r, labelOffset: i =
|
|
|
558
579
|
o,
|
|
559
580
|
s,
|
|
560
581
|
d
|
|
561
|
-
]), x = c(() =>
|
|
582
|
+
]), x = c(() => mt(b, t), [t, b]), S = c(() => Math.max(i, ht(b, x, t) * .015), [
|
|
562
583
|
x,
|
|
563
584
|
t,
|
|
564
585
|
i,
|
|
@@ -568,11 +589,11 @@ function gt({ color: e, floorY: t, fontSize: n = Ge, grids: r, labelOffset: i =
|
|
|
568
589
|
let e = g.current;
|
|
569
590
|
if (!e) return;
|
|
570
591
|
let t = h.position.clone();
|
|
571
|
-
e.worldToLocal(t), !(t.distanceToSquared(_) <
|
|
592
|
+
e.worldToLocal(t), !(t.distanceToSquared(_) < Xe) && v(t);
|
|
572
593
|
}), !m || !b.length ? null : /* @__PURE__ */ L("group", {
|
|
573
594
|
ref: g,
|
|
574
595
|
userData: { modelGrids: !0 },
|
|
575
|
-
children: b.map((e) => /* @__PURE__ */ L(
|
|
596
|
+
children: b.map((e) => /* @__PURE__ */ L(_t, {
|
|
576
597
|
cameraPosition: _,
|
|
577
598
|
color: y,
|
|
578
599
|
floorY: t,
|
|
@@ -587,9 +608,9 @@ function gt({ color: e, floorY: t, fontSize: n = Ge, grids: r, labelOffset: i =
|
|
|
587
608
|
e.startSide,
|
|
588
609
|
e.endSide,
|
|
589
610
|
e.name,
|
|
590
|
-
|
|
591
|
-
t ??
|
|
592
|
-
|
|
611
|
+
B(e.loc, "x"),
|
|
612
|
+
t ?? B(e.loc, "y"),
|
|
613
|
+
B(e.loc, "z"),
|
|
593
614
|
e.points[0].x,
|
|
594
615
|
e.points[0].y,
|
|
595
616
|
e.points[0].z,
|
|
@@ -601,8 +622,8 @@ function gt({ color: e, floorY: t, fontSize: n = Ge, grids: r, labelOffset: i =
|
|
|
601
622
|
}
|
|
602
623
|
//#endregion
|
|
603
624
|
//#region src/viewer/Model.tsx
|
|
604
|
-
var
|
|
605
|
-
function
|
|
625
|
+
var yt = new N();
|
|
626
|
+
function bt(e) {
|
|
606
627
|
if (!e) return null;
|
|
607
628
|
try {
|
|
608
629
|
let t = JSON.parse(e);
|
|
@@ -611,23 +632,23 @@ function vt(e) {
|
|
|
611
632
|
return console.warn("Model matrix parsing error", e), null;
|
|
612
633
|
}
|
|
613
634
|
}
|
|
614
|
-
function
|
|
615
|
-
return
|
|
635
|
+
function xt(e) {
|
|
636
|
+
return bt(St(e));
|
|
616
637
|
}
|
|
617
|
-
function
|
|
638
|
+
function St(e) {
|
|
618
639
|
return e.coordinationMatrix ?? Object.values(e.data)[0]?.matrix;
|
|
619
640
|
}
|
|
620
|
-
function
|
|
641
|
+
function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r }) {
|
|
621
642
|
let i = z((e) => e.gridAxesVisibility), a = c(() => {
|
|
622
643
|
if (!r) return {
|
|
623
644
|
data: [],
|
|
624
645
|
coordinationMatrix: null,
|
|
625
646
|
floorY: 0
|
|
626
647
|
};
|
|
627
|
-
let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ??
|
|
648
|
+
let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? xt(r) : null, i = Infinity, a = new I();
|
|
628
649
|
return {
|
|
629
650
|
data: Object.values(r.data).map((e) => {
|
|
630
|
-
let t = (
|
|
651
|
+
let t = (bt(e.matrix) ?? new N()).clone().invert(), r = e.mat, o = e.pos;
|
|
631
652
|
for (let e = 0; e < o.length; e += 3) a.set(o[e], o[e + 1], o[e + 2]).applyMatrix4(t), Number.isFinite(a.y) && (i = Math.min(i, a.y));
|
|
632
653
|
return {
|
|
633
654
|
data: e,
|
|
@@ -646,16 +667,16 @@ function xt({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
646
667
|
n
|
|
647
668
|
]);
|
|
648
669
|
return r ? /* @__PURE__ */ R("group", {
|
|
649
|
-
matrix: a.coordinationMatrix ??
|
|
670
|
+
matrix: a.coordinationMatrix ?? yt,
|
|
650
671
|
matrixAutoUpdate: !1,
|
|
651
672
|
userData: { modelID: n },
|
|
652
|
-
children: [a.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ L(
|
|
673
|
+
children: [a.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ L(Ke, {
|
|
653
674
|
colorPaletteTexture: e,
|
|
654
675
|
material: i,
|
|
655
676
|
data: t,
|
|
656
677
|
isIfcSpace: n,
|
|
657
678
|
meshMatrix: a
|
|
658
|
-
}, r)), /* @__PURE__ */ L(
|
|
679
|
+
}, r)), /* @__PURE__ */ L(vt, {
|
|
659
680
|
floorY: a.floorY,
|
|
660
681
|
grids: r.grids,
|
|
661
682
|
showBottom: i.bottom,
|
|
@@ -666,10 +687,10 @@ function xt({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
666
687
|
})]
|
|
667
688
|
}) : /* @__PURE__ */ L(Ce, {});
|
|
668
689
|
}
|
|
669
|
-
var
|
|
690
|
+
var wt = r(Ct);
|
|
670
691
|
//#endregion
|
|
671
692
|
//#region src/viewer/utils/GeometryUtils/useGeometryIndex.ts
|
|
672
|
-
function
|
|
693
|
+
function Tt() {
|
|
673
694
|
return {
|
|
674
695
|
elementIndex: /* @__PURE__ */ new Map(),
|
|
675
696
|
ifcSpacesVisible: !0,
|
|
@@ -679,10 +700,10 @@ function Ct() {
|
|
|
679
700
|
records: /* @__PURE__ */ new Set()
|
|
680
701
|
};
|
|
681
702
|
}
|
|
682
|
-
function
|
|
703
|
+
function Et(e) {
|
|
683
704
|
return e instanceof Uint16Array || e instanceof Uint32Array ? e : e.length > 65535 ? new Uint32Array(e) : new Uint16Array(e);
|
|
684
705
|
}
|
|
685
|
-
function
|
|
706
|
+
function Dt(e, t, n, r) {
|
|
686
707
|
let i = n.get(e);
|
|
687
708
|
if (i) return i;
|
|
688
709
|
i = {
|
|
@@ -692,20 +713,20 @@ function Tt(e, t, n, r) {
|
|
|
692
713
|
let a = r.get(e);
|
|
693
714
|
return a || (a = [], r.set(e, a)), a.push(i), i;
|
|
694
715
|
}
|
|
695
|
-
function
|
|
696
|
-
n &&
|
|
716
|
+
function Ot(e, t, n, r, i, a) {
|
|
717
|
+
n && Dt(e, r, i, a).vertexRanges.push({
|
|
697
718
|
count: n,
|
|
698
719
|
start: t
|
|
699
720
|
});
|
|
700
721
|
}
|
|
701
|
-
function
|
|
702
|
-
n && (
|
|
722
|
+
function kt(e, t, n, r, i, a) {
|
|
723
|
+
n && (Dt(e, r, i, a), r.triangleRanges.push({
|
|
703
724
|
count: n,
|
|
704
725
|
id: e,
|
|
705
726
|
start: t
|
|
706
727
|
}));
|
|
707
728
|
}
|
|
708
|
-
function
|
|
729
|
+
function At(e) {
|
|
709
730
|
let t = e;
|
|
710
731
|
for (; t;) {
|
|
711
732
|
let e = t.userData.modelID;
|
|
@@ -714,11 +735,11 @@ function Ot(e) {
|
|
|
714
735
|
}
|
|
715
736
|
return 0;
|
|
716
737
|
}
|
|
717
|
-
function
|
|
738
|
+
function jt(e) {
|
|
718
739
|
return e.name === "space" || e.userData.isIfcSpace === !0;
|
|
719
740
|
}
|
|
720
|
-
function
|
|
721
|
-
let t = l(
|
|
741
|
+
function Mt(e) {
|
|
742
|
+
let t = l(Tt()), n = i(() => {
|
|
722
743
|
let n = e.current, r = t.current;
|
|
723
744
|
if (!n || r.indexedModel === n && r.records.size) return r;
|
|
724
745
|
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
@@ -726,10 +747,10 @@ function At(e) {
|
|
|
726
747
|
if (!(e instanceof P)) return;
|
|
727
748
|
let t = e, n = t.geometry, r = n.index, o = n.attributes.ids;
|
|
728
749
|
if (!r || !o) return;
|
|
729
|
-
let s =
|
|
750
|
+
let s = At(t), c = Et(r.array), l = {
|
|
730
751
|
hiddenIds: /* @__PURE__ */ new Set(),
|
|
731
752
|
initialVisible: t.visible,
|
|
732
|
-
isIfcSpace:
|
|
753
|
+
isIfcSpace: jt(t),
|
|
733
754
|
mesh: t,
|
|
734
755
|
modelID: s,
|
|
735
756
|
originalBoundsTree: n.boundsTree ?? null,
|
|
@@ -739,15 +760,15 @@ function At(e) {
|
|
|
739
760
|
}, u = /* @__PURE__ */ new Map(), d = null, f = 0, p = c.length / 3;
|
|
740
761
|
for (let e = 0; e < p; e++) {
|
|
741
762
|
let t = o.getX(c[e * 3]);
|
|
742
|
-
d === null ? (d = t, f = e) : t !== d && (
|
|
763
|
+
d === null ? (d = t, f = e) : t !== d && (kt(d, f, e - f, l, u, i), d = t, f = e);
|
|
743
764
|
}
|
|
744
|
-
d !== null &&
|
|
765
|
+
d !== null && kt(d, f, p - f, l, u, i);
|
|
745
766
|
let m = null, h = 0;
|
|
746
767
|
for (let e = 0; e < o.count; e++) {
|
|
747
768
|
let t = o.getX(e);
|
|
748
|
-
m === null ? (m = t, h = e) : t !== m && (
|
|
769
|
+
m === null ? (m = t, h = e) : t !== m && (Ot(m, h, e - h, l, u, i), m = t, h = e);
|
|
749
770
|
}
|
|
750
|
-
m !== null &&
|
|
771
|
+
m !== null && Ot(m, h, o.count - h, l, u, i), a.add(l);
|
|
751
772
|
}), t.current = {
|
|
752
773
|
elementIndex: i,
|
|
753
774
|
ifcSpacesVisible: r.ifcSpacesVisible,
|
|
@@ -757,7 +778,7 @@ function At(e) {
|
|
|
757
778
|
records: a
|
|
758
779
|
}, t.current;
|
|
759
780
|
}, [e]), r = i(() => {
|
|
760
|
-
t.current =
|
|
781
|
+
t.current = Tt();
|
|
761
782
|
}, []);
|
|
762
783
|
return c(() => ({
|
|
763
784
|
buildIndex: n,
|
|
@@ -766,95 +787,95 @@ function At(e) {
|
|
|
766
787
|
}
|
|
767
788
|
//#endregion
|
|
768
789
|
//#region src/viewer/utils/GeometryUtils/useGeometryUtils.ts
|
|
769
|
-
function
|
|
790
|
+
function Nt(e, t) {
|
|
770
791
|
return e instanceof Uint32Array ? new Uint32Array(t) : new Uint16Array(t);
|
|
771
792
|
}
|
|
772
|
-
function
|
|
793
|
+
function Pt(e) {
|
|
773
794
|
let t = e.geometry;
|
|
774
795
|
Object.assign(t, { boundsTree: void 0 }), e.geometry.index?.count && Object.assign(t, { boundsTree: new be(e.geometry, { indirect: !0 }) });
|
|
775
796
|
}
|
|
776
|
-
function
|
|
777
|
-
e.mesh.geometry.setIndex(new v(t, 1)), n &&
|
|
797
|
+
function Ft(e, t, n = !0) {
|
|
798
|
+
e.mesh.geometry.setIndex(new v(t, 1)), n && Pt(e.mesh);
|
|
778
799
|
}
|
|
779
|
-
function
|
|
800
|
+
function It(e, t) {
|
|
780
801
|
return e.initialVisible && (!e.isIfcSpace || t);
|
|
781
802
|
}
|
|
782
|
-
function
|
|
803
|
+
function Lt(e, t) {
|
|
783
804
|
let n = e.mesh.geometry, r = n.index?.array;
|
|
784
|
-
e.mesh.visible =
|
|
805
|
+
e.mesh.visible = It(e, t), r !== e.originalIndex && Ft(e, e.originalIndex, !1), e.originalBoundsTree ? Object.assign(n, { boundsTree: e.originalBoundsTree }) : (Pt(e.mesh), e.originalBoundsTree = e.mesh.geometry.boundsTree ?? null);
|
|
785
806
|
}
|
|
786
|
-
function
|
|
807
|
+
function Rt(e) {
|
|
787
808
|
return e === null ? "*" : e.size ? Array.from(e).sort((e, t) => e - t).join(",") : "";
|
|
788
809
|
}
|
|
789
|
-
function
|
|
790
|
-
return `h:${
|
|
810
|
+
function zt(e, t, n, r) {
|
|
811
|
+
return `h:${Rt(e)}|i:${Rt(n)}|s:${r ? Number(t) : ""}`;
|
|
791
812
|
}
|
|
792
|
-
function
|
|
813
|
+
function Bt(e, t, n) {
|
|
793
814
|
return !t.has(e) && (!n || n.has(e));
|
|
794
815
|
}
|
|
795
|
-
function
|
|
816
|
+
function Vt(e, t) {
|
|
796
817
|
Object.entries(e).forEach(([e, n]) => {
|
|
797
818
|
n.forEach((n) => t(Number(e), n));
|
|
798
819
|
});
|
|
799
820
|
}
|
|
800
|
-
function
|
|
821
|
+
function Ht(e, t, n) {
|
|
801
822
|
e.hiddenIds.has(t) || (e.hiddenIds.add(t), n.add(e));
|
|
802
823
|
}
|
|
803
|
-
function
|
|
824
|
+
function V(e, t, n) {
|
|
804
825
|
e && console.log(`${t}:`, Date.now() - n, "ms");
|
|
805
826
|
}
|
|
806
|
-
function
|
|
807
|
-
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s =
|
|
827
|
+
function H(e, t, n, r) {
|
|
828
|
+
let { hiddenIds: i, originalIndex: a, triangleRanges: o } = e, s = zt(i, t, n, e.isIfcSpace);
|
|
808
829
|
if (e.visibleStateKey === s) return;
|
|
809
830
|
if (!i.size && !n) {
|
|
810
|
-
|
|
831
|
+
Lt(e, t), e.visibleStateKey = s;
|
|
811
832
|
return;
|
|
812
833
|
}
|
|
813
834
|
let c = 0, l = 0;
|
|
814
835
|
if (o.forEach(({ count: e, id: t }) => {
|
|
815
|
-
|
|
836
|
+
Bt(t, i, n) ? c += e * 3 : l += e * 3;
|
|
816
837
|
}), !c) {
|
|
817
|
-
|
|
838
|
+
Lt(e, t), e.mesh.visible = !1, e.visibleStateKey = s;
|
|
818
839
|
return;
|
|
819
840
|
}
|
|
820
841
|
if (!l) {
|
|
821
|
-
|
|
842
|
+
Lt(e, t), e.visibleStateKey = s;
|
|
822
843
|
return;
|
|
823
844
|
}
|
|
824
|
-
e.mesh.visible =
|
|
825
|
-
let u =
|
|
845
|
+
e.mesh.visible = It(e, t);
|
|
846
|
+
let u = Nt(a, c), d = 0;
|
|
826
847
|
for (let e = 0; e < o.length; e++) {
|
|
827
848
|
let { count: t, id: r, start: s } = o[e];
|
|
828
|
-
if (!
|
|
849
|
+
if (!Bt(r, i, n)) continue;
|
|
829
850
|
let c = s * 3, l = c + t * 3;
|
|
830
851
|
u.set(a.subarray(c, l), d), d += t * 3;
|
|
831
852
|
}
|
|
832
|
-
r || (e.originalBoundsTree = null),
|
|
853
|
+
r || (e.originalBoundsTree = null), Ft(e, u), e.visibleStateKey = s;
|
|
833
854
|
}
|
|
834
|
-
function
|
|
855
|
+
function U(e, t) {
|
|
835
856
|
return e.isolatedIdsByModel ? e.isolatedIdsByModel.get(t.modelID) ?? /* @__PURE__ */ new Set() : e.isolatedIds;
|
|
836
857
|
}
|
|
837
|
-
function
|
|
858
|
+
function Ut(e) {
|
|
838
859
|
let t = z((e) => e.selected), n = z((e) => e.resetSelected), r = z((e) => e.showStats), a = z((e) => e.userDevice) === "pc", o = e.buildIndex, s = i(() => Array.from(o().elementIndex.keys()), [o]), c = i(() => o().ifcSpacesVisible, [o]), l = i((e) => {
|
|
839
860
|
let t = Date.now(), n = o(), i = /* @__PURE__ */ new Set();
|
|
840
861
|
e.forEach((e) => {
|
|
841
862
|
let t = n.elementIndex.get(e);
|
|
842
863
|
t && t.forEach(({ record: t }) => {
|
|
843
|
-
|
|
864
|
+
Ht(t, e, i);
|
|
844
865
|
});
|
|
845
|
-
}), i.forEach((e) =>
|
|
866
|
+
}), i.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "hideByIds", t);
|
|
846
867
|
}, [
|
|
847
868
|
o,
|
|
848
869
|
a,
|
|
849
870
|
r
|
|
850
871
|
]), u = i(() => {
|
|
851
872
|
let e = Date.now(), i = o(), s = /* @__PURE__ */ new Set();
|
|
852
|
-
|
|
873
|
+
Vt(t, (e, t) => {
|
|
853
874
|
let n = i.elementIndex.get(t);
|
|
854
875
|
n && n.forEach(({ record: n }) => {
|
|
855
|
-
n.modelID === e &&
|
|
876
|
+
n.modelID === e && Ht(n, t, s);
|
|
856
877
|
});
|
|
857
|
-
}), s.forEach((e) =>
|
|
878
|
+
}), s.forEach((e) => H(e, i.ifcSpacesVisible, U(i, e), a)), n(), V(r, "hideSelected", e);
|
|
858
879
|
}, [
|
|
859
880
|
o,
|
|
860
881
|
a,
|
|
@@ -868,24 +889,24 @@ function Vt(e) {
|
|
|
868
889
|
t && t.forEach(({ record: t }) => {
|
|
869
890
|
t.hiddenIds.delete(e) && i.add(t);
|
|
870
891
|
});
|
|
871
|
-
}), i.forEach((e) =>
|
|
892
|
+
}), i.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "showByIds", t);
|
|
872
893
|
}, [
|
|
873
894
|
o,
|
|
874
895
|
a,
|
|
875
896
|
r
|
|
876
897
|
]), f = i((e) => {
|
|
877
898
|
let t = Date.now(), n = o();
|
|
878
|
-
n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) =>
|
|
899
|
+
n.isolatedIdsByModel = null, n.isolatedIds = new Set(e), n.records.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "isolateByIds", t);
|
|
879
900
|
}, [
|
|
880
901
|
o,
|
|
881
902
|
a,
|
|
882
903
|
r
|
|
883
904
|
]), p = i(() => {
|
|
884
905
|
let e = Date.now(), n = o(), i = /* @__PURE__ */ new Map();
|
|
885
|
-
|
|
906
|
+
Vt(t, (e, t) => {
|
|
886
907
|
let n = i.get(e);
|
|
887
908
|
n || (n = /* @__PURE__ */ new Set(), i.set(e, n)), n.add(t);
|
|
888
|
-
}), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) =>
|
|
909
|
+
}), n.isolatedIdsByModel = i, n.isolatedIds = null, n.records.forEach((e) => H(e, n.ifcSpacesVisible, U(n, e), a)), V(r, "isolateSelected", e);
|
|
889
910
|
}, [
|
|
890
911
|
o,
|
|
891
912
|
a,
|
|
@@ -893,7 +914,7 @@ function Vt(e) {
|
|
|
893
914
|
r
|
|
894
915
|
]), m = i(() => {
|
|
895
916
|
let e = Date.now(), t = o();
|
|
896
|
-
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) =>
|
|
917
|
+
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => H(e, t.ifcSpacesVisible, U(t, e), a)), V(r, "resetIsolation", e);
|
|
897
918
|
}, [
|
|
898
919
|
o,
|
|
899
920
|
a,
|
|
@@ -901,7 +922,7 @@ function Vt(e) {
|
|
|
901
922
|
]), h = i((e) => {
|
|
902
923
|
let t = o();
|
|
903
924
|
t.ifcSpacesVisible !== e && (t.ifcSpacesVisible = e, t.records.forEach((e) => {
|
|
904
|
-
e.isIfcSpace &&
|
|
925
|
+
e.isIfcSpace && H(e, t.ifcSpacesVisible, U(t, e), a);
|
|
905
926
|
}));
|
|
906
927
|
}, [o, a]), g = i(() => {
|
|
907
928
|
h(!c());
|
|
@@ -919,8 +940,8 @@ function Vt(e) {
|
|
|
919
940
|
showAll: i(() => {
|
|
920
941
|
let e = Date.now(), t = o();
|
|
921
942
|
t.isolatedIdsByModel = null, t.isolatedIds = null, t.records.forEach((e) => {
|
|
922
|
-
e.hiddenIds.clear(),
|
|
923
|
-
}),
|
|
943
|
+
e.hiddenIds.clear(), H(e, t.ifcSpacesVisible, U(t, e), a);
|
|
944
|
+
}), V(r, "showAll", e);
|
|
924
945
|
}, [
|
|
925
946
|
o,
|
|
926
947
|
a,
|
|
@@ -932,30 +953,30 @@ function Vt(e) {
|
|
|
932
953
|
}
|
|
933
954
|
//#endregion
|
|
934
955
|
//#region src/viewer/utils/ClippingUtils/ClippingEdges.ts
|
|
935
|
-
var
|
|
936
|
-
function
|
|
956
|
+
var Wt = 1024, Gt = -1e-5;
|
|
957
|
+
function Kt(e) {
|
|
937
958
|
let t = new v(new Float32Array(e * 3), 3, !1);
|
|
938
959
|
return t.setUsage(T), t;
|
|
939
960
|
}
|
|
940
|
-
function
|
|
961
|
+
function qt(e) {
|
|
941
962
|
return Math.max(1, Math.ceil((e.geometry.index?.count ?? 0) / 3));
|
|
942
963
|
}
|
|
943
|
-
function
|
|
944
|
-
let n = new y(), r = Math.ceil(Math.min(Math.max(
|
|
945
|
-
n.setAttribute("position",
|
|
964
|
+
function Jt(e, t) {
|
|
965
|
+
let n = new y(), r = Math.ceil(Math.min(Math.max(Wt, qt(t) * .05), 32768));
|
|
966
|
+
n.setAttribute("position", Kt(r)), n.setDrawRange(0, 0);
|
|
946
967
|
let i = new j(n, e);
|
|
947
968
|
return i.frustumCulled = !1, i.renderOrder = 1, i.visible = !1, i;
|
|
948
969
|
}
|
|
949
|
-
function
|
|
970
|
+
function Yt(e, t) {
|
|
950
971
|
let n = e.geometry.getAttribute("position");
|
|
951
972
|
if (n.count > t) return n;
|
|
952
|
-
let r =
|
|
973
|
+
let r = Kt(Math.max(n.count * 2, t + 1));
|
|
953
974
|
return r.array.set(n.array), e.geometry.setAttribute("position", r), n = r, n;
|
|
954
975
|
}
|
|
955
|
-
function
|
|
976
|
+
function Xt(e) {
|
|
956
977
|
return e.filter((e) => e.parent && e.geometry.index?.count);
|
|
957
978
|
}
|
|
958
|
-
var
|
|
979
|
+
var Zt = class {
|
|
959
980
|
active;
|
|
960
981
|
material;
|
|
961
982
|
plane;
|
|
@@ -985,12 +1006,12 @@ var Yt = class {
|
|
|
985
1006
|
return this.syncMeshes(), Array.from(this.lines.values());
|
|
986
1007
|
}
|
|
987
1008
|
syncMeshes() {
|
|
988
|
-
let e = new Set(
|
|
1009
|
+
let e = new Set(Xt(this.context.getMeshes()));
|
|
989
1010
|
this.lines.forEach((t, n) => {
|
|
990
1011
|
e.has(n) || (t.removeFromParent(), t.geometry.dispose(), this.lines.delete(n));
|
|
991
1012
|
}), e.forEach((e) => {
|
|
992
1013
|
if (this.lines.has(e)) return;
|
|
993
|
-
let t =
|
|
1014
|
+
let t = Jt(this.material, e);
|
|
994
1015
|
e.add(t), this.lines.set(e, t);
|
|
995
1016
|
}), this.setVisible(this.active);
|
|
996
1017
|
}
|
|
@@ -1016,7 +1037,7 @@ var Yt = class {
|
|
|
1016
1037
|
}
|
|
1017
1038
|
t.updateWorldMatrix(!0, !1), this.inverseMatrix.copy(t.matrixWorld).invert(), this.localPlane.copy(this.plane).applyMatrix4(this.inverseMatrix);
|
|
1018
1039
|
let r = 0, i = e.geometry.getAttribute("position"), a = (t) => {
|
|
1019
|
-
i =
|
|
1040
|
+
i = Yt(e, r), i.setXYZ(r, t.x, t.y, t.z), r++;
|
|
1020
1041
|
};
|
|
1021
1042
|
n.shapecast({
|
|
1022
1043
|
intersectsBounds: (e) => this.localPlane.intersectsBox(e),
|
|
@@ -1024,19 +1045,19 @@ var Yt = class {
|
|
|
1024
1045
|
let t = 0;
|
|
1025
1046
|
this.tempLine.start.copy(e.a), this.tempLine.end.copy(e.b), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), t++), this.tempLine.start.copy(e.b), this.tempLine.end.copy(e.c), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), t++), this.tempLine.start.copy(e.c), this.tempLine.end.copy(e.a), this.localPlane.intersectLine(this.tempLine, this.tempVector) && (a(this.tempVector), t++), t === 3 && (this.tempVector1.fromBufferAttribute(i, r - 3), this.tempVector2.fromBufferAttribute(i, r - 2), this.tempVector3.fromBufferAttribute(i, r - 1), this.tempVector3.equals(this.tempVector1) || this.tempVector3.equals(this.tempVector2) ? (t--, r--) : this.tempVector1.equals(this.tempVector2) && (i.setXYZ(r - 2, this.tempVector3.x, this.tempVector3.y, this.tempVector3.z), t--, r--)), t !== 2 && (r -= t);
|
|
1026
1047
|
}
|
|
1027
|
-
}), e.geometry.setDrawRange(0, r), e.position.copy(this.localPlane.normal).multiplyScalar(
|
|
1048
|
+
}), e.geometry.setDrawRange(0, r), e.position.copy(this.localPlane.normal).multiplyScalar(Gt), i.needsUpdate = !0;
|
|
1028
1049
|
}));
|
|
1029
1050
|
}
|
|
1030
|
-
},
|
|
1031
|
-
function
|
|
1051
|
+
}, Qt = "#0b2f5f", $t = "#0b2f5f", en = 0, tn = "#1f7ae0", nn = .22, rn = .01, an = .025, on = .015, sn = .25, cn = .15, ln = .25, W = 1;
|
|
1052
|
+
function un(e, t) {
|
|
1032
1053
|
let n = t.getBoundingClientRect();
|
|
1033
1054
|
return new F((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
|
|
1034
1055
|
}
|
|
1035
|
-
function
|
|
1056
|
+
function dn(e) {
|
|
1036
1057
|
let t = e.getSize(new I());
|
|
1037
|
-
return Math.max(
|
|
1058
|
+
return Math.max(ln, t.length() * rn);
|
|
1038
1059
|
}
|
|
1039
|
-
var
|
|
1060
|
+
var fn = class extends ae {
|
|
1040
1061
|
helper = new D();
|
|
1041
1062
|
borderMaterial;
|
|
1042
1063
|
material;
|
|
@@ -1054,15 +1075,15 @@ var un = class extends ae {
|
|
|
1054
1075
|
listenersActive = !1;
|
|
1055
1076
|
constructor(e, t, n, r) {
|
|
1056
1077
|
super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new ne({
|
|
1057
|
-
color:
|
|
1078
|
+
color: $t,
|
|
1058
1079
|
depthWrite: !1,
|
|
1059
|
-
opacity:
|
|
1080
|
+
opacity: en,
|
|
1060
1081
|
side: w,
|
|
1061
1082
|
transparent: !0
|
|
1062
1083
|
}), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
|
|
1063
|
-
let i = Math.max(
|
|
1084
|
+
let i = Math.max(sn, Math.min(this.layout.width, this.layout.height) * an), a = Math.max(cn, Math.min(this.layout.width, this.layout.height) * on);
|
|
1064
1085
|
this.borderMaterial = new ee({
|
|
1065
|
-
color:
|
|
1086
|
+
color: Qt,
|
|
1066
1087
|
dashSize: i,
|
|
1067
1088
|
depthWrite: !1,
|
|
1068
1089
|
gapSize: a
|
|
@@ -1093,7 +1114,7 @@ var un = class extends ae {
|
|
|
1093
1114
|
}
|
|
1094
1115
|
updateBorderDash() {
|
|
1095
1116
|
let e = Math.min(this.layout.width, this.layout.height);
|
|
1096
|
-
this.borderMaterial.dashSize = Math.max(
|
|
1117
|
+
this.borderMaterial.dashSize = Math.max(sn, e * an), this.borderMaterial.gapSize = Math.max(cn, e * on), this.borderMaterial.needsUpdate = !0;
|
|
1097
1118
|
}
|
|
1098
1119
|
addEventListeners() {
|
|
1099
1120
|
if (this.listenersActive) return;
|
|
@@ -1135,7 +1156,7 @@ var un = class extends ae {
|
|
|
1135
1156
|
}
|
|
1136
1157
|
getPointerPointOnPlane(e, t) {
|
|
1137
1158
|
let n = this.context.getDomElement();
|
|
1138
|
-
this.pointer.copy(
|
|
1159
|
+
this.pointer.copy(un(e, n));
|
|
1139
1160
|
let r = this.context.getRaycaster(), i = new I();
|
|
1140
1161
|
return r.setFromCamera(this.pointer, this.context.getCamera()), r.ray.intersectPlane(t, i);
|
|
1141
1162
|
}
|
|
@@ -1192,7 +1213,7 @@ var un = class extends ae {
|
|
|
1192
1213
|
this.hovered !== t && this.setHovered(t);
|
|
1193
1214
|
}
|
|
1194
1215
|
setHovered(e) {
|
|
1195
|
-
this.hovered = e, this.material.color.set(e ?
|
|
1216
|
+
this.hovered = e, this.material.color.set(e ? tn : $t), this.material.opacity = e ? nn : en, this.material.needsUpdate = !0;
|
|
1196
1217
|
}
|
|
1197
1218
|
createPlaneMesh() {
|
|
1198
1219
|
let e = new P(new y(), this.material);
|
|
@@ -1268,12 +1289,12 @@ var un = class extends ae {
|
|
|
1268
1289
|
getHelperLayout() {
|
|
1269
1290
|
let e = this.getModelWorldBox();
|
|
1270
1291
|
if (!e || e.isEmpty()) return {
|
|
1271
|
-
height:
|
|
1272
|
-
maxU:
|
|
1273
|
-
maxV:
|
|
1274
|
-
minU: -
|
|
1275
|
-
minV: -
|
|
1276
|
-
width:
|
|
1292
|
+
height: W,
|
|
1293
|
+
maxU: W / 2,
|
|
1294
|
+
maxV: W / 2,
|
|
1295
|
+
minU: -W / 2,
|
|
1296
|
+
minV: -W / 2,
|
|
1297
|
+
width: W
|
|
1277
1298
|
};
|
|
1278
1299
|
let t = this.getPlaneBasis(), n = this.helper.position, r = this.getBoxCorners(e), i = new I(), a = new I(), o = Infinity, s = -Infinity, c = Infinity, l = -Infinity;
|
|
1279
1300
|
if (r.forEach((e) => {
|
|
@@ -1281,14 +1302,14 @@ var un = class extends ae {
|
|
|
1281
1302
|
let r = a.dot(t.u), u = a.dot(t.v);
|
|
1282
1303
|
o = Math.min(o, r), s = Math.max(s, r), c = Math.min(c, u), l = Math.max(l, u);
|
|
1283
1304
|
}), !Number.isFinite(o) || !Number.isFinite(s) || !Number.isFinite(c) || !Number.isFinite(l)) return {
|
|
1284
|
-
height:
|
|
1285
|
-
maxU:
|
|
1286
|
-
maxV:
|
|
1287
|
-
minU: -
|
|
1288
|
-
minV: -
|
|
1289
|
-
width:
|
|
1305
|
+
height: W,
|
|
1306
|
+
maxU: W / 2,
|
|
1307
|
+
maxV: W / 2,
|
|
1308
|
+
minU: -W / 2,
|
|
1309
|
+
minV: -W / 2,
|
|
1310
|
+
width: W
|
|
1290
1311
|
};
|
|
1291
|
-
let u =
|
|
1312
|
+
let u = dn(e), d = o - u, f = s + u, p = c - u, m = l + u, h = Math.max(W, f - d), g = Math.max(W, m - p), _ = (d + f) / 2, v = (p + m) / 2;
|
|
1292
1313
|
return {
|
|
1293
1314
|
height: g,
|
|
1294
1315
|
maxU: _ + h / 2,
|
|
@@ -1332,7 +1353,7 @@ var un = class extends ae {
|
|
|
1332
1353
|
};
|
|
1333
1354
|
//#endregion
|
|
1334
1355
|
//#region src/viewer/utils/ClippingUtils/ClippingUtils.ts
|
|
1335
|
-
function
|
|
1356
|
+
function pn(e, t) {
|
|
1336
1357
|
if (Array.isArray(e)) {
|
|
1337
1358
|
e.forEach((e) => {
|
|
1338
1359
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
@@ -1341,13 +1362,13 @@ function dn(e, t) {
|
|
|
1341
1362
|
}
|
|
1342
1363
|
e.clippingPlanes = t, e.needsUpdate = !0;
|
|
1343
1364
|
}
|
|
1344
|
-
function
|
|
1365
|
+
function mn(e) {
|
|
1345
1366
|
let t = [];
|
|
1346
1367
|
return e?.traverse((e) => {
|
|
1347
1368
|
e instanceof P && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
|
|
1348
1369
|
}), t;
|
|
1349
1370
|
}
|
|
1350
|
-
function
|
|
1371
|
+
function hn(e) {
|
|
1351
1372
|
let t = e;
|
|
1352
1373
|
for (; t;) {
|
|
1353
1374
|
let e = t.userData.modelID;
|
|
@@ -1356,10 +1377,10 @@ function pn(e) {
|
|
|
1356
1377
|
}
|
|
1357
1378
|
return 0;
|
|
1358
1379
|
}
|
|
1359
|
-
function
|
|
1380
|
+
function gn(e, t) {
|
|
1360
1381
|
return t.clone().transformDirection(e.matrixWorld).normalize();
|
|
1361
1382
|
}
|
|
1362
|
-
var
|
|
1383
|
+
var _n = class {
|
|
1363
1384
|
planes = [];
|
|
1364
1385
|
edges = [];
|
|
1365
1386
|
helpers = [];
|
|
@@ -1408,7 +1429,7 @@ var hn = class {
|
|
|
1408
1429
|
return this.context.controlRef;
|
|
1409
1430
|
}
|
|
1410
1431
|
getMeshes() {
|
|
1411
|
-
return
|
|
1432
|
+
return mn(this.context.modelRef.current);
|
|
1412
1433
|
}
|
|
1413
1434
|
getHelperHoverIsMoving() {
|
|
1414
1435
|
return this.helperHoverMoveState !== "end" && this.helperHoverMoveState !== "start";
|
|
@@ -1444,7 +1465,7 @@ var hn = class {
|
|
|
1444
1465
|
getSelectedWorldBox() {
|
|
1445
1466
|
let e = this.context.viewerStore.getState().selected, t = new g(), n = new I();
|
|
1446
1467
|
return this.getMeshes().forEach((r) => {
|
|
1447
|
-
let i = e[
|
|
1468
|
+
let i = e[hn(r)];
|
|
1448
1469
|
if (!i?.size) return;
|
|
1449
1470
|
let a = r.geometry.attributes.ids, o = r.geometry.attributes.position;
|
|
1450
1471
|
if (!a || !o) return;
|
|
@@ -1463,7 +1484,7 @@ var hn = class {
|
|
|
1463
1484
|
updateMaterials() {
|
|
1464
1485
|
let e = this.active ? this.planes : [];
|
|
1465
1486
|
this.getMeshes().forEach((t) => {
|
|
1466
|
-
|
|
1487
|
+
pn(t.material, e);
|
|
1467
1488
|
}), this.context.camera.updateMatrixWorld();
|
|
1468
1489
|
}
|
|
1469
1490
|
setActive(e) {
|
|
@@ -1482,7 +1503,7 @@ var hn = class {
|
|
|
1482
1503
|
recursive: !1
|
|
1483
1504
|
});
|
|
1484
1505
|
if (!n?.face) return null;
|
|
1485
|
-
let r = n.point.clone(), i =
|
|
1506
|
+
let r = n.point.clone(), i = gn(n.object, n.face.normal);
|
|
1486
1507
|
r.add(i.clone().multiplyScalar(.001));
|
|
1487
1508
|
let a = new ce().setFromNormalAndCoplanarPoint(i.clone().negate(), r);
|
|
1488
1509
|
return this.addPlane(a, r, i), a.clone();
|
|
@@ -1490,7 +1511,7 @@ var hn = class {
|
|
|
1490
1511
|
createClippingRectangle(e = !1) {
|
|
1491
1512
|
let t = e ? this.getSelectedWorldBox() : this.getModelWorldBox();
|
|
1492
1513
|
if (!t) return [];
|
|
1493
|
-
let n =
|
|
1514
|
+
let n = dn(t), r = t.min.clone().addScalar(-n), i = t.max.clone().addScalar(n), a = t.getCenter(new I()), o = [
|
|
1494
1515
|
{
|
|
1495
1516
|
normal: new I(1, 0, 0),
|
|
1496
1517
|
point: new I(r.x, a.y, a.z)
|
|
@@ -1525,8 +1546,8 @@ var hn = class {
|
|
|
1525
1546
|
}), this.updateHelpers(), o.map(({ plane: e }) => e.clone());
|
|
1526
1547
|
}
|
|
1527
1548
|
addPlane(e, t, n) {
|
|
1528
|
-
if (this.active || this.setActive(!0), this.planes.push(e), new
|
|
1529
|
-
let t = new
|
|
1549
|
+
if (this.active || this.setActive(!0), this.planes.push(e), new fn(this, e, t, n), this.updateHelpers(), this.updateMaterials(), this.edgesActive) {
|
|
1550
|
+
let t = new Zt(this, e);
|
|
1530
1551
|
t.create(), t.update();
|
|
1531
1552
|
}
|
|
1532
1553
|
}
|
|
@@ -1538,7 +1559,7 @@ var hn = class {
|
|
|
1538
1559
|
}
|
|
1539
1560
|
setEdgesActive(e) {
|
|
1540
1561
|
this.edgesActive !== e && (this.edgesActive = e, e && this.edges.length !== this.planes.length && (this.edges.forEach((e) => e.dispose()), this.edges = [], this.planes.forEach((e) => {
|
|
1541
|
-
let t = new
|
|
1562
|
+
let t = new Zt(this, e);
|
|
1542
1563
|
t.create(), t.update();
|
|
1543
1564
|
})), this.edges.forEach((t) => t.setVisible(this.active && e)));
|
|
1544
1565
|
}
|
|
@@ -1565,8 +1586,8 @@ var hn = class {
|
|
|
1565
1586
|
this.deleteAllPlanes();
|
|
1566
1587
|
}
|
|
1567
1588
|
};
|
|
1568
|
-
function
|
|
1569
|
-
let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.raycaster), s = p((e) => e.scene), l =
|
|
1589
|
+
function vn(e, t, n) {
|
|
1590
|
+
let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.raycaster), s = p((e) => e.scene), l = Ee(), u = c(() => new _n({
|
|
1570
1591
|
camera: r,
|
|
1571
1592
|
cameraUtils: n,
|
|
1572
1593
|
controlRef: t,
|
|
@@ -1636,19 +1657,19 @@ function gn(e, t, n) {
|
|
|
1636
1657
|
}
|
|
1637
1658
|
//#endregion
|
|
1638
1659
|
//#region src/viewer/utils/DimentionsUtils/DimentionLine.ts
|
|
1639
|
-
var
|
|
1640
|
-
function
|
|
1660
|
+
var yn = 12, bn = 6, xn = 4;
|
|
1661
|
+
function Sn() {
|
|
1641
1662
|
return typeof window > "u" ? 1 : Math.min(window.devicePixelRatio || 1, 2);
|
|
1642
1663
|
}
|
|
1643
|
-
function
|
|
1664
|
+
function Cn(e, t) {
|
|
1644
1665
|
return e instanceof oe ? (e.top - e.bottom) / e.zoom : e instanceof se ? 2 * Math.tan(e.fov * Math.PI / 360) * Math.max(t, .001) : Math.max(t, 1);
|
|
1645
1666
|
}
|
|
1646
|
-
function
|
|
1647
|
-
let t =
|
|
1667
|
+
function wn(e) {
|
|
1668
|
+
let t = Sn(), n = document.createElement("canvas"), r = n.getContext("2d");
|
|
1648
1669
|
if (!r) throw Error("Could not create dimension label canvas context");
|
|
1649
|
-
let i = `600 ${
|
|
1670
|
+
let i = `600 ${yn}px system-ui, "Segoe UI", sans-serif`;
|
|
1650
1671
|
r.font = i;
|
|
1651
|
-
let a = r.measureText(e), o = a.actualBoundingBoxAscent ||
|
|
1672
|
+
let a = r.measureText(e), o = a.actualBoundingBoxAscent || yn * .8, s = a.actualBoundingBoxDescent || yn * .2, c = Math.max(1, Math.ceil(a.width + bn * 2)), l = Math.max(1, Math.ceil(o + s + xn * 2));
|
|
1652
1673
|
n.width = Math.ceil(c * t), n.height = Math.ceil(l * t), r.scale(t, t), r.clearRect(0, 0, c, l), r.fillStyle = "rgba(255, 255, 255, 0.86)", r.strokeStyle = "rgba(29, 39, 51, 0.22)", r.lineWidth = 1, r.beginPath(), r.roundRect(.5, .5, c - 1, l - 1, 4), r.fill(), r.stroke(), r.font = i, r.fillStyle = "#111827", r.textAlign = "center", r.textBaseline = "middle", r.fillText(e, c / 2, l / 2);
|
|
1653
1674
|
let u = new b(n);
|
|
1654
1675
|
return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = M, u.minFilter = M, u.needsUpdate = !0, {
|
|
@@ -1657,7 +1678,7 @@ function Sn(e) {
|
|
|
1657
1678
|
width: c
|
|
1658
1679
|
};
|
|
1659
1680
|
}
|
|
1660
|
-
var
|
|
1681
|
+
var Tn = class e {
|
|
1661
1682
|
static scale = 1;
|
|
1662
1683
|
static scaleFactor = .015;
|
|
1663
1684
|
static units = "m";
|
|
@@ -1752,7 +1773,7 @@ var Cn = class e {
|
|
|
1752
1773
|
let e = this.getTextContent();
|
|
1753
1774
|
if (this.labelText === e) return;
|
|
1754
1775
|
this.labelText = e, this.labelTexture?.dispose();
|
|
1755
|
-
let t =
|
|
1776
|
+
let t = wn(e);
|
|
1756
1777
|
this.labelHeight = t.height, this.labelTexture = t.texture, this.labelWidth = t.width, this.labelSprite.material.map = t.texture, this.labelSprite.material.needsUpdate = !0;
|
|
1757
1778
|
}
|
|
1758
1779
|
updatePositions() {
|
|
@@ -1763,34 +1784,34 @@ var Cn = class e {
|
|
|
1763
1784
|
this.boundingMesh && (this.boundingMesh.position.copy(this.center), this.boundingMesh.lookAt(this.end), this.boundingMesh.geometry.dispose(), this.boundingMesh.geometry = new _(1, 1, Math.max(this.length, .001)));
|
|
1764
1785
|
}
|
|
1765
1786
|
rescaleMesh(t, n, r) {
|
|
1766
|
-
let i =
|
|
1787
|
+
let i = Cn(n, t.position.distanceTo(n.position)) / Math.max(1, r) * 12 * e.scaleFactor;
|
|
1767
1788
|
t.scale.setScalar(i);
|
|
1768
1789
|
}
|
|
1769
1790
|
rescaleBoundingMesh(e, t) {
|
|
1770
1791
|
if (!this.boundingMesh) return;
|
|
1771
|
-
let n =
|
|
1792
|
+
let n = Cn(e, this.boundingMesh.position.distanceTo(e.position)) / Math.max(1, t) * 8;
|
|
1772
1793
|
this.boundingMesh.scale.set(n, n, 1);
|
|
1773
1794
|
}
|
|
1774
1795
|
rescaleLabel(e, t) {
|
|
1775
|
-
let n =
|
|
1796
|
+
let n = Cn(e, this.labelSprite.position.distanceTo(e.position)), r = this.labelHeight / Math.max(1, t) * n, i = r * (this.labelWidth / this.labelHeight);
|
|
1776
1797
|
this.labelSprite.scale.set(i, r, 1);
|
|
1777
1798
|
}
|
|
1778
|
-
},
|
|
1779
|
-
function
|
|
1799
|
+
}, En = "#111827", Dn = 1, On = "x";
|
|
1800
|
+
function kn(e) {
|
|
1780
1801
|
let t = [];
|
|
1781
1802
|
return e?.traverse((e) => {
|
|
1782
1803
|
e instanceof P && e.geometry.attributes.position && t.push(e);
|
|
1783
1804
|
}), t;
|
|
1784
1805
|
}
|
|
1785
|
-
function
|
|
1806
|
+
function An(e, t, n) {
|
|
1786
1807
|
let r = e.clone();
|
|
1787
1808
|
return r[n] = t[n], r;
|
|
1788
1809
|
}
|
|
1789
|
-
function
|
|
1810
|
+
function jn(e, t) {
|
|
1790
1811
|
let n = Math.hypot(t.y - e.y, t.z - e.z), r = Math.hypot(t.x - e.x, t.z - e.z), i = Math.hypot(t.x - e.x, t.y - e.y), a = Math.min(n, r, i);
|
|
1791
1812
|
return a === n ? "x" : a === r ? "y" : "z";
|
|
1792
1813
|
}
|
|
1793
|
-
var
|
|
1814
|
+
var Mn = class e {
|
|
1794
1815
|
active = !1;
|
|
1795
1816
|
axis = null;
|
|
1796
1817
|
boundingMaterial = new ne({
|
|
@@ -1805,13 +1826,13 @@ var An = class e {
|
|
|
1805
1826
|
dimensions = [];
|
|
1806
1827
|
endpointGeometry = e.createEndpointGeometry();
|
|
1807
1828
|
endpointMaterial = new ne({
|
|
1808
|
-
color:
|
|
1829
|
+
color: En,
|
|
1809
1830
|
depthTest: !1,
|
|
1810
1831
|
depthWrite: !1
|
|
1811
1832
|
});
|
|
1812
1833
|
endpointScale = new I(1, 1, 1);
|
|
1813
1834
|
lineMaterial = new ee({
|
|
1814
|
-
color:
|
|
1835
|
+
color: En,
|
|
1815
1836
|
dashSize: .2,
|
|
1816
1837
|
depthTest: !1,
|
|
1817
1838
|
depthWrite: !1,
|
|
@@ -1825,7 +1846,7 @@ var An = class e {
|
|
|
1825
1846
|
depthWrite: !1
|
|
1826
1847
|
}));
|
|
1827
1848
|
root = new D();
|
|
1828
|
-
snapDistance =
|
|
1849
|
+
snapDistance = Dn;
|
|
1829
1850
|
startPoint = new I();
|
|
1830
1851
|
unit = "m";
|
|
1831
1852
|
constructor(e) {
|
|
@@ -1859,13 +1880,13 @@ var An = class e {
|
|
|
1859
1880
|
});
|
|
1860
1881
|
}
|
|
1861
1882
|
setEndpointScaleFactor(e) {
|
|
1862
|
-
!Number.isFinite(e) || e <= 0 || (
|
|
1883
|
+
!Number.isFinite(e) || e <= 0 || (Tn.scaleFactor = e);
|
|
1863
1884
|
}
|
|
1864
1885
|
setSnapDistance(e) {
|
|
1865
1886
|
!Number.isFinite(e) || e < 0 || (this.snapDistance = e);
|
|
1866
1887
|
}
|
|
1867
1888
|
setUnit(e) {
|
|
1868
|
-
this.unit = e,
|
|
1889
|
+
this.unit = e, Tn.units = e, Tn.scale = e === "mm" ? 1e3 : 1, this.dimensions.forEach((e) => {
|
|
1869
1890
|
e.endPoint = e.end;
|
|
1870
1891
|
}), this.currentDimension && (this.currentDimension.endPoint = this.currentDimension.end);
|
|
1871
1892
|
}
|
|
@@ -1891,7 +1912,7 @@ var An = class e {
|
|
|
1891
1912
|
changeAxes() {
|
|
1892
1913
|
if (!this.measureInProcess || !this.currentDimension) return;
|
|
1893
1914
|
let e = this.currentDimension.end, t = this.getNextAxis();
|
|
1894
|
-
this.axis = t, this.currentDimension.endPoint =
|
|
1915
|
+
this.axis = t, this.currentDimension.endPoint = An(this.startPoint, e, t);
|
|
1895
1916
|
}
|
|
1896
1917
|
updateFrame() {
|
|
1897
1918
|
if (!this.active) return;
|
|
@@ -1935,7 +1956,7 @@ var An = class e {
|
|
|
1935
1956
|
this.currentDimension && (this.currentDimension.createBoundingBox(), this.dimensions.push(this.currentDimension), this.currentDimension = null, this.measureInProcess = !1, this.axis = null);
|
|
1936
1957
|
}
|
|
1937
1958
|
createDimension(e, t) {
|
|
1938
|
-
return new
|
|
1959
|
+
return new Tn({
|
|
1939
1960
|
boundingMaterial: this.boundingMaterial,
|
|
1940
1961
|
endpointGeometry: this.endpointGeometry,
|
|
1941
1962
|
endpointMaterial: this.endpointMaterial,
|
|
@@ -1947,7 +1968,7 @@ var An = class e {
|
|
|
1947
1968
|
});
|
|
1948
1969
|
}
|
|
1949
1970
|
getModelHit(e) {
|
|
1950
|
-
let t =
|
|
1971
|
+
let t = kn(this.context.modelRef.current);
|
|
1951
1972
|
return t.length ? this.context.cameraUtils.getIntersection(!0, {
|
|
1952
1973
|
event: e,
|
|
1953
1974
|
filter: (e) => !!e.face,
|
|
@@ -1974,15 +1995,15 @@ var An = class e {
|
|
|
1974
1995
|
}
|
|
1975
1996
|
getPreviewEndPoint(e, t) {
|
|
1976
1997
|
if (!t) return this.axis = null, e.clone();
|
|
1977
|
-
let n = this.axis ??
|
|
1978
|
-
return this.axis = n,
|
|
1998
|
+
let n = this.axis ?? jn(this.startPoint, e);
|
|
1999
|
+
return this.axis = n, An(this.startPoint, e, n);
|
|
1979
2000
|
}
|
|
1980
2001
|
getNextAxis() {
|
|
1981
2002
|
switch (this.axis) {
|
|
1982
2003
|
case "x": return "y";
|
|
1983
2004
|
case "y": return "z";
|
|
1984
2005
|
case "z": return "x";
|
|
1985
|
-
default: return
|
|
2006
|
+
default: return On;
|
|
1986
2007
|
}
|
|
1987
2008
|
}
|
|
1988
2009
|
getIsMoving() {
|
|
@@ -2029,8 +2050,8 @@ var An = class e {
|
|
|
2029
2050
|
return new fe(.5, 16, 12);
|
|
2030
2051
|
}
|
|
2031
2052
|
};
|
|
2032
|
-
function
|
|
2033
|
-
let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.scene), s = p((e) => e.size), l =
|
|
2053
|
+
function Nn(e, t, n) {
|
|
2054
|
+
let r = p((e) => e.camera), i = p((e) => e.gl), a = p((e) => e.scene), s = p((e) => e.size), l = Ee(), u = c(() => new Mn({
|
|
2034
2055
|
camera: r,
|
|
2035
2056
|
cameraUtils: n,
|
|
2036
2057
|
controlRef: t,
|
|
@@ -2092,15 +2113,15 @@ function jn(e, t, n) {
|
|
|
2092
2113
|
}
|
|
2093
2114
|
//#endregion
|
|
2094
2115
|
//#region src/viewer/utils/Hotkeys/useHotkeysUtils.tsx
|
|
2095
|
-
function
|
|
2116
|
+
function Pn(e) {
|
|
2096
2117
|
return e instanceof HTMLElement ? e.isContentEditable || e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement : !1;
|
|
2097
2118
|
}
|
|
2098
|
-
function
|
|
2119
|
+
function Fn() {
|
|
2099
2120
|
let e = z((e) => e.api), t = z((e) => e.defaultHotkeysEnabled);
|
|
2100
2121
|
o(() => {
|
|
2101
2122
|
if (!t) return;
|
|
2102
2123
|
let n = (t) => {
|
|
2103
|
-
|
|
2124
|
+
Pn(t.target) || (t.code === "KeyI" && e?.geometryUtils.isolateSelected(), t.code === "KeyH" && e?.geometryUtils.hideSelected(), t.code === "KeyC" && e?.geometryUtils.showAll(), t.code === "KeyP" && e?.clipping.createPlane(), t.code === "KeyM" && e?.dimensions.toggle());
|
|
2104
2125
|
};
|
|
2105
2126
|
return window.addEventListener("keydown", n), () => {
|
|
2106
2127
|
window.removeEventListener("keydown", n);
|
|
@@ -2109,15 +2130,15 @@ function Nn() {
|
|
|
2109
2130
|
}
|
|
2110
2131
|
//#endregion
|
|
2111
2132
|
//#region src/viewer/Camera/useCameraUtils.ts
|
|
2112
|
-
var
|
|
2113
|
-
function
|
|
2133
|
+
var In = 1e-6;
|
|
2134
|
+
function Ln(e, t) {
|
|
2114
2135
|
let n = t.getBoundingClientRect();
|
|
2115
2136
|
return n.width <= 0 || n.height <= 0 || e.clientX < n.left || e.clientX > n.right || e.clientY < n.top || e.clientY > n.bottom ? null : new F((e.clientX - n.left) / n.width * 2 - 1, -((e.clientY - n.top) / n.height) * 2 + 1);
|
|
2116
2137
|
}
|
|
2117
|
-
function
|
|
2118
|
-
return t.every((t) => t.distanceToPoint(e) >= -
|
|
2138
|
+
function Rn(e, t) {
|
|
2139
|
+
return t.every((t) => t.distanceToPoint(e) >= -In);
|
|
2119
2140
|
}
|
|
2120
|
-
function
|
|
2141
|
+
function zn(e) {
|
|
2121
2142
|
let t = e;
|
|
2122
2143
|
for (; t;) {
|
|
2123
2144
|
if (!t.visible) return !1;
|
|
@@ -2125,7 +2146,7 @@ function Ln(e) {
|
|
|
2125
2146
|
}
|
|
2126
2147
|
return !0;
|
|
2127
2148
|
}
|
|
2128
|
-
function
|
|
2149
|
+
function Bn(e) {
|
|
2129
2150
|
let t = p((e) => e.camera), n = p((e) => e.gl), r = p((e) => e.raycaster), a = l(null), s = l(null), u = l(new F()), d = i((e) => {
|
|
2130
2151
|
a.current = e;
|
|
2131
2152
|
}, []), f = i(() => {
|
|
@@ -2134,7 +2155,7 @@ function Rn(e) {
|
|
|
2134
2155
|
}, []);
|
|
2135
2156
|
o(() => {
|
|
2136
2157
|
let e = n.domElement, t = (t) => {
|
|
2137
|
-
let n =
|
|
2158
|
+
let n = Ln(t, e);
|
|
2138
2159
|
n && (s.current = n);
|
|
2139
2160
|
}, r = () => {
|
|
2140
2161
|
s.current = null;
|
|
@@ -2144,11 +2165,11 @@ function Rn(e) {
|
|
|
2144
2165
|
};
|
|
2145
2166
|
}, [n]);
|
|
2146
2167
|
let m = i((i = !1, { event: a, filter: o, object: c = e.current, recursive: l = !0, respectClipping: d = !0 } = {}) => {
|
|
2147
|
-
let p = a ?
|
|
2168
|
+
let p = a ? Ln(a, n.domElement) : s.current;
|
|
2148
2169
|
if (!p || !c) return i ? null : [];
|
|
2149
2170
|
let m = d ? f() : [], h = Array.isArray(c) ? c : [c];
|
|
2150
2171
|
t.updateMatrixWorld(), e.current?.updateMatrixWorld(!0), u.current.copy(p), r.setFromCamera(u.current, t);
|
|
2151
|
-
let g = r.intersectObjects(h, l).filter((e) =>
|
|
2172
|
+
let g = r.intersectObjects(h, l).filter((e) => zn(e.object) ? m.length ? Rn(e.point, m) : !0 : !1).filter((e) => o ? o(e) : !0);
|
|
2152
2173
|
return i ? g[0] ?? null : g;
|
|
2153
2174
|
}, [
|
|
2154
2175
|
t,
|
|
@@ -2169,8 +2190,8 @@ function Rn(e) {
|
|
|
2169
2190
|
}
|
|
2170
2191
|
//#endregion
|
|
2171
2192
|
//#region src/viewer/Selector/SelectionBox.ts
|
|
2172
|
-
var
|
|
2173
|
-
function
|
|
2193
|
+
var Vn = new I(), Hn = new I(), G = new F(), Un = new I(), Wn = new I(), Gn = new I(), Kn = new I(), qn = new I(), Jn = new I(), Yn = new I();
|
|
2194
|
+
function Xn(e) {
|
|
2174
2195
|
let t = e;
|
|
2175
2196
|
for (; t;) {
|
|
2176
2197
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -2179,7 +2200,7 @@ function Jn(e) {
|
|
|
2179
2200
|
}
|
|
2180
2201
|
return 0;
|
|
2181
2202
|
}
|
|
2182
|
-
function
|
|
2203
|
+
function Zn(e) {
|
|
2183
2204
|
let t = e;
|
|
2184
2205
|
for (; t;) {
|
|
2185
2206
|
if (!t.visible) return !1;
|
|
@@ -2187,16 +2208,16 @@ function Yn(e) {
|
|
|
2187
2208
|
}
|
|
2188
2209
|
return !0;
|
|
2189
2210
|
}
|
|
2190
|
-
function
|
|
2191
|
-
return n.length ? (
|
|
2211
|
+
function Qn(e, t, n) {
|
|
2212
|
+
return n.length ? (Un.copy(t).applyMatrix4(e.matrixWorld), Rn(Un, n)) : !0;
|
|
2192
2213
|
}
|
|
2193
|
-
function
|
|
2194
|
-
return i.length ? (
|
|
2195
|
-
let t = e.distanceToPoint(
|
|
2214
|
+
function $n(e, t, n, r, i) {
|
|
2215
|
+
return i.length ? (Wn.copy(t).applyMatrix4(e.matrixWorld), Gn.copy(n).applyMatrix4(e.matrixWorld), Kn.copy(r).applyMatrix4(e.matrixWorld), i.every((e) => {
|
|
2216
|
+
let t = e.distanceToPoint(Wn), n = e.distanceToPoint(Gn), r = e.distanceToPoint(Kn);
|
|
2196
2217
|
return !(t < -1e-6 && n < -1e-6 && r < -1e-6);
|
|
2197
2218
|
})) : !0;
|
|
2198
2219
|
}
|
|
2199
|
-
function
|
|
2220
|
+
function er(e) {
|
|
2200
2221
|
let t = e.getBoundingClientRect();
|
|
2201
2222
|
return {
|
|
2202
2223
|
height: t.height,
|
|
@@ -2205,7 +2226,7 @@ function Qn(e) {
|
|
|
2205
2226
|
width: t.width
|
|
2206
2227
|
};
|
|
2207
2228
|
}
|
|
2208
|
-
function
|
|
2229
|
+
function tr(e) {
|
|
2209
2230
|
return {
|
|
2210
2231
|
boundsCheckMs: 0,
|
|
2211
2232
|
candidateIds: 0,
|
|
@@ -2231,7 +2252,7 @@ function $n(e) {
|
|
|
2231
2252
|
triangleProjectionMs: 0
|
|
2232
2253
|
};
|
|
2233
2254
|
}
|
|
2234
|
-
function
|
|
2255
|
+
function nr(e, t) {
|
|
2235
2256
|
return {
|
|
2236
2257
|
minX: Math.min(e.x, t.x),
|
|
2237
2258
|
minY: Math.min(e.y, t.y),
|
|
@@ -2239,43 +2260,43 @@ function er(e, t) {
|
|
|
2239
2260
|
maxY: Math.max(e.y, t.y)
|
|
2240
2261
|
};
|
|
2241
2262
|
}
|
|
2242
|
-
function
|
|
2263
|
+
function rr(e, t) {
|
|
2243
2264
|
return t.x >= e.x ? "contains" : "intersects";
|
|
2244
2265
|
}
|
|
2245
|
-
function
|
|
2246
|
-
return
|
|
2266
|
+
function ir(e, t) {
|
|
2267
|
+
return ar(e.x, e.y, t);
|
|
2247
2268
|
}
|
|
2248
|
-
function
|
|
2269
|
+
function ar(e, t, n) {
|
|
2249
2270
|
return e >= n.minX && e <= n.maxX && t >= n.minY && t <= n.maxY;
|
|
2250
2271
|
}
|
|
2251
|
-
function
|
|
2272
|
+
function or(e, t, n, r, i, a) {
|
|
2252
2273
|
return (a - t) * (n - e) > (r - t) * (i - e);
|
|
2253
2274
|
}
|
|
2254
|
-
function
|
|
2255
|
-
return
|
|
2275
|
+
function sr(e, t, n, r, i, a, o, s) {
|
|
2276
|
+
return or(e, t, i, a, o, s) !== or(n, r, i, a, o, s) && or(e, t, n, r, i, a) !== or(e, t, n, r, o, s);
|
|
2256
2277
|
}
|
|
2257
|
-
function
|
|
2278
|
+
function cr(e, t, n, r, i) {
|
|
2258
2279
|
let a = .5 * (-r.y * i.x + n.y * (-r.x + i.x) + n.x * (r.y - i.y) + r.x * i.y), o = a < 0 ? -1 : 1, s = (n.y * i.x - n.x * i.y + (i.y - n.y) * e + (n.x - i.x) * t) * o, c = (n.x * r.y - n.y * r.x + (n.y - r.y) * e + (r.x - n.x) * t) * o;
|
|
2259
2280
|
return s >= 0 && c >= 0 && s + c <= 2 * a * o;
|
|
2260
2281
|
}
|
|
2261
|
-
function
|
|
2262
|
-
return
|
|
2282
|
+
function lr(e, t, n, r) {
|
|
2283
|
+
return ir(e, r) || ir(t, r) || ir(n, r) || cr(r.minX, r.minY, e, t, n) || cr(r.maxX, r.minY, e, t, n) || cr(r.maxX, r.maxY, e, t, n) || cr(r.minX, r.maxY, e, t, n) ? !0 : ur(e, t, r) || ur(t, n, r) || ur(n, e, r);
|
|
2263
2284
|
}
|
|
2264
|
-
function
|
|
2265
|
-
return
|
|
2285
|
+
function ur(e, t, n) {
|
|
2286
|
+
return sr(e.x, e.y, t.x, t.y, n.minX, n.minY, n.maxX, n.minY) || sr(e.x, e.y, t.x, t.y, n.maxX, n.minY, n.maxX, n.maxY) || sr(e.x, e.y, t.x, t.y, n.maxX, n.maxY, n.minX, n.maxY) || sr(e.x, e.y, t.x, t.y, n.minX, n.maxY, n.minX, n.minY);
|
|
2266
2287
|
}
|
|
2267
|
-
function
|
|
2268
|
-
let a =
|
|
2288
|
+
function dr(e, t, n, r, i = new F()) {
|
|
2289
|
+
let a = Vn.copy(t).applyMatrix4(e.matrixWorld).project(n);
|
|
2269
2290
|
return i.set((a.x + 1) / 2 * r.width + r.left, (-a.y + 1) / 2 * r.height + r.top);
|
|
2270
2291
|
}
|
|
2271
|
-
function
|
|
2292
|
+
function fr(e, t, n, r, i) {
|
|
2272
2293
|
let a = Infinity, o = -Infinity, s = Infinity, c = -Infinity, l = 0;
|
|
2273
|
-
for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++)
|
|
2294
|
+
for (let u = 0; u < 2; u++) for (let d = 0; d < 2; d++) for (let f = 0; f < 2; f++) Hn.set(u ? t.max.x : t.min.x, d ? t.max.y : t.min.y, f ? t.max.z : t.min.z), dr(e, Hn, r, i, G), a = Math.min(a, G.x), o = Math.max(o, G.x), s = Math.min(s, G.y), c = Math.max(c, G.y), ir(G, n) && (l += 1);
|
|
2274
2295
|
return o < n.minX || a > n.maxX || c < n.minY || s > n.maxY ? xe : l === 8 ? ve : ye;
|
|
2275
2296
|
}
|
|
2276
|
-
function
|
|
2297
|
+
function pr(e, t, n, r) {
|
|
2277
2298
|
let i = Infinity, a = -Infinity, o = Infinity, s = -Infinity;
|
|
2278
|
-
for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++)
|
|
2299
|
+
for (let c = 0; c < 2; c++) for (let l = 0; l < 2; l++) for (let u = 0; u < 2; u++) Hn.set(c ? t.max.x : t.min.x, l ? t.max.y : t.min.y, u ? t.max.z : t.min.z), dr(e, Hn, n, r, G), i = Math.min(i, G.x), a = Math.max(a, G.x), o = Math.min(o, G.y), s = Math.max(s, G.y);
|
|
2279
2300
|
return {
|
|
2280
2301
|
minX: i,
|
|
2281
2302
|
minY: o,
|
|
@@ -2283,41 +2304,41 @@ function dr(e, t, n, r) {
|
|
|
2283
2304
|
maxY: s
|
|
2284
2305
|
};
|
|
2285
2306
|
}
|
|
2286
|
-
function
|
|
2307
|
+
function mr(e, t) {
|
|
2287
2308
|
return !(e.maxX < t.minX || e.minX > t.maxX || e.maxY < t.minY || e.minY > t.maxY);
|
|
2288
2309
|
}
|
|
2289
|
-
function
|
|
2310
|
+
function hr(e, t, n, r) {
|
|
2290
2311
|
e.geometry.boundingBox || e.geometry.computeBoundingBox();
|
|
2291
2312
|
let i = e.geometry.boundingBox;
|
|
2292
|
-
return i ?
|
|
2313
|
+
return i ? mr(pr(e, i, n, r), t) : !0;
|
|
2293
2314
|
}
|
|
2294
|
-
function
|
|
2315
|
+
function gr(e, t, n) {
|
|
2295
2316
|
let r = e.get(t);
|
|
2296
2317
|
r || (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
2297
2318
|
}
|
|
2298
|
-
function
|
|
2319
|
+
function _r(e) {
|
|
2299
2320
|
let t = 0;
|
|
2300
2321
|
return e.forEach((e) => {
|
|
2301
2322
|
t += e.size;
|
|
2302
2323
|
}), t;
|
|
2303
2324
|
}
|
|
2304
|
-
function
|
|
2325
|
+
function vr(e, t, n, r = []) {
|
|
2305
2326
|
let i = e.geometry, a = i.index, o = i.attributes.ids, s = i.attributes.position;
|
|
2306
2327
|
if (!a || !o || !s) return;
|
|
2307
2328
|
let c = t * 3;
|
|
2308
|
-
r.length && (
|
|
2329
|
+
r.length && (qn.fromBufferAttribute(s, a.getX(c)), Jn.fromBufferAttribute(s, a.getX(c + 1)), Yn.fromBufferAttribute(s, a.getX(c + 2)), !$n(e, qn, Jn, Yn, r)) || gr(n, Xn(e), o.getX(a.getX(c)));
|
|
2309
2330
|
}
|
|
2310
|
-
function
|
|
2331
|
+
function yr({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i, clippingPlanes: a, profile: o }) {
|
|
2311
2332
|
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = new I();
|
|
2312
2333
|
e.traverse((e) => {
|
|
2313
2334
|
let s = e;
|
|
2314
|
-
if (!s.isMesh || !
|
|
2335
|
+
if (!s.isMesh || !Zn(s)) return;
|
|
2315
2336
|
let u = s.geometry.attributes.ids, d = s.geometry.attributes.position;
|
|
2316
2337
|
if (!(!u || !d)) {
|
|
2317
2338
|
o && (o.containedVerticesVisited += u.count);
|
|
2318
2339
|
for (let e = 0; e < u.count; e++) {
|
|
2319
|
-
let f =
|
|
2320
|
-
if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !
|
|
2340
|
+
let f = Xn(s), p = u.getX(e);
|
|
2341
|
+
if (!i.get(f)?.has(p) || (l.fromBufferAttribute(d, e), !Qn(s, l, a))) continue;
|
|
2321
2342
|
o && (o.containedCandidateVertices += 1);
|
|
2322
2343
|
let m = `${f}:${p}`, h = c.get(m);
|
|
2323
2344
|
h || (h = {
|
|
@@ -2325,23 +2346,23 @@ function _r({ model: e, camera: t, viewport: n, rect: r, candidateIdsByModel: i,
|
|
|
2325
2346
|
inside: 0,
|
|
2326
2347
|
modelID: f,
|
|
2327
2348
|
total: 0
|
|
2328
|
-
}, c.set(m, h)), h.total += 1,
|
|
2349
|
+
}, c.set(m, h)), h.total += 1, ir(dr(s, l, t, n), r) && (h.inside += 1);
|
|
2329
2350
|
}
|
|
2330
2351
|
}
|
|
2331
2352
|
});
|
|
2332
2353
|
let u = /* @__PURE__ */ new Map();
|
|
2333
2354
|
return c.forEach((e) => {
|
|
2334
|
-
e.total > 0 && e.total === e.inside &&
|
|
2355
|
+
e.total > 0 && e.total === e.inside && gr(u, e.modelID, e.id);
|
|
2335
2356
|
}), o && (o.containedIdsMs += performance.now() - s), u;
|
|
2336
2357
|
}
|
|
2337
|
-
function
|
|
2358
|
+
function br({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect: i, mode: a, profile: o }) {
|
|
2338
2359
|
let s = performance.now(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
2339
2360
|
if (!e) return c;
|
|
2340
|
-
let u =
|
|
2361
|
+
let u = er(r), d = performance.now();
|
|
2341
2362
|
e.updateMatrixWorld(!0), t.updateMatrixWorld(), o && (o.matrixUpdateMs += performance.now() - d), e.traverse((e) => {
|
|
2342
2363
|
let r = e;
|
|
2343
2364
|
if (!r.isMesh) return;
|
|
2344
|
-
if (o && (o.meshCount += 1), !
|
|
2365
|
+
if (o && (o.meshCount += 1), !Zn(r)) {
|
|
2345
2366
|
o && (o.skippedMeshCount += 1);
|
|
2346
2367
|
return;
|
|
2347
2368
|
}
|
|
@@ -2350,7 +2371,7 @@ function vr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
2350
2371
|
o && (o.skippedMeshCount += 1);
|
|
2351
2372
|
return;
|
|
2352
2373
|
}
|
|
2353
|
-
let d = performance.now(), f =
|
|
2374
|
+
let d = performance.now(), f = hr(r, i, t, u);
|
|
2354
2375
|
if (o && (o.boundsCheckMs += performance.now() - d), !f) {
|
|
2355
2376
|
o && (o.skippedMeshCount += 1);
|
|
2356
2377
|
return;
|
|
@@ -2358,26 +2379,26 @@ function vr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
2358
2379
|
let p = performance.now();
|
|
2359
2380
|
s.shapecast({
|
|
2360
2381
|
intersectsBounds: (e) => {
|
|
2361
|
-
let n = performance.now(), a =
|
|
2382
|
+
let n = performance.now(), a = fr(r, e, i, t, u);
|
|
2362
2383
|
return o && (o.intersectsBoundsCalls += 1, o.intersectsBoundsMs += performance.now() - n), a;
|
|
2363
2384
|
},
|
|
2364
2385
|
intersectsRange: (e, t, i) => {
|
|
2365
2386
|
let u = performance.now();
|
|
2366
2387
|
if (o && (o.intersectsRangeCalls += 1), !i) return o && (o.intersectsRangeMs += performance.now() - u), !1;
|
|
2367
|
-
for (let i = e; i < e + t; i++)
|
|
2388
|
+
for (let i = e; i < e + t; i++) vr(r, s.resolveTriangleIndex(i), a === "contains" ? l : c, n);
|
|
2368
2389
|
return o && (o.intersectsRangeMs += performance.now() - u), !1;
|
|
2369
2390
|
},
|
|
2370
2391
|
intersectsTriangle: (e, s, d) => {
|
|
2371
2392
|
let f = performance.now();
|
|
2372
2393
|
if (o && (o.intersectsTriangleCalls += 1), !d) {
|
|
2373
|
-
let n = performance.now(), a =
|
|
2374
|
-
if (o && (o.triangleProjectionMs += performance.now() - n), !
|
|
2394
|
+
let n = performance.now(), a = dr(r, e.a, t, u), s = dr(r, e.b, t, u), c = dr(r, e.c, t, u);
|
|
2395
|
+
if (o && (o.triangleProjectionMs += performance.now() - n), !lr(a, s, c, i)) return o && (o.intersectsTriangleMs += performance.now() - f), !1;
|
|
2375
2396
|
}
|
|
2376
|
-
return a === "contains" ?
|
|
2397
|
+
return a === "contains" ? vr(r, s, l, n) : vr(r, s, c, n), o && (o.intersectsTriangleMs += performance.now() - f), !1;
|
|
2377
2398
|
}
|
|
2378
2399
|
}), o && (o.shapecastMs += performance.now() - p);
|
|
2379
2400
|
});
|
|
2380
|
-
let f = a === "contains" ?
|
|
2401
|
+
let f = a === "contains" ? yr({
|
|
2381
2402
|
model: e,
|
|
2382
2403
|
camera: t,
|
|
2383
2404
|
clippingPlanes: n,
|
|
@@ -2386,19 +2407,19 @@ function vr({ model: e, camera: t, clippingPlanes: n = [], domElement: r, rect:
|
|
|
2386
2407
|
candidateIdsByModel: l,
|
|
2387
2408
|
profile: o
|
|
2388
2409
|
}) : c;
|
|
2389
|
-
return o && (o.candidateIds =
|
|
2410
|
+
return o && (o.candidateIds = _r(l), o.selectedIds = _r(f), o.totalMs = performance.now() - s), f;
|
|
2390
2411
|
}
|
|
2391
|
-
function
|
|
2392
|
-
let t =
|
|
2412
|
+
function xr(e) {
|
|
2413
|
+
let t = tr(e.mode);
|
|
2393
2414
|
return {
|
|
2394
|
-
ids:
|
|
2415
|
+
ids: br({
|
|
2395
2416
|
...e,
|
|
2396
2417
|
profile: t
|
|
2397
2418
|
}),
|
|
2398
2419
|
profile: t
|
|
2399
2420
|
};
|
|
2400
2421
|
}
|
|
2401
|
-
function
|
|
2422
|
+
function Sr(e) {
|
|
2402
2423
|
return e === "contains" ? {
|
|
2403
2424
|
border: "rgb(37, 99, 235)",
|
|
2404
2425
|
background: "rgba(37, 99, 235, 0.16)"
|
|
@@ -2407,32 +2428,32 @@ function br(e) {
|
|
|
2407
2428
|
background: "rgba(22, 163, 74, 0.16)"
|
|
2408
2429
|
};
|
|
2409
2430
|
}
|
|
2410
|
-
function
|
|
2411
|
-
let r =
|
|
2431
|
+
function Cr(e, t, n) {
|
|
2432
|
+
let r = Sr(rr(t, n));
|
|
2412
2433
|
if (!e.current) {
|
|
2413
2434
|
let t = document.createElement("div");
|
|
2414
2435
|
t.style.position = "fixed", t.style.pointerEvents = "none", t.style.zIndex = "10", e.current = t, document.body.appendChild(t);
|
|
2415
2436
|
}
|
|
2416
|
-
let i =
|
|
2437
|
+
let i = nr(t, n);
|
|
2417
2438
|
e.current.style.border = `1px solid ${r.border}`, e.current.style.background = r.background, e.current.style.left = `${i.minX}px`, e.current.style.top = `${i.minY}px`, e.current.style.width = `${i.maxX - i.minX}px`, e.current.style.height = `${i.maxY - i.minY}px`;
|
|
2418
2439
|
}
|
|
2419
|
-
function
|
|
2440
|
+
function wr(e) {
|
|
2420
2441
|
e.current?.remove(), e.current = null;
|
|
2421
2442
|
}
|
|
2422
2443
|
//#endregion
|
|
2423
2444
|
//#region src/viewer/Selector/useSelector.tsx
|
|
2424
|
-
var
|
|
2425
|
-
function
|
|
2445
|
+
var Tr = 40;
|
|
2446
|
+
function Er(e) {
|
|
2426
2447
|
if (!Array.isArray(e)) return e.userData.shader;
|
|
2427
2448
|
}
|
|
2428
|
-
function
|
|
2429
|
-
let n =
|
|
2449
|
+
function Dr(e, t) {
|
|
2450
|
+
let n = Er(e)?.uniforms.preSelectionId;
|
|
2430
2451
|
n && (n.value = t);
|
|
2431
2452
|
}
|
|
2432
|
-
function
|
|
2453
|
+
function Or(e) {
|
|
2433
2454
|
return Number(e.current?.modelID ?? 0);
|
|
2434
2455
|
}
|
|
2435
|
-
function
|
|
2456
|
+
function kr(e) {
|
|
2436
2457
|
let t = e;
|
|
2437
2458
|
for (; t;) {
|
|
2438
2459
|
let e = t.modelID ?? t.userData.modelID;
|
|
@@ -2441,7 +2462,7 @@ function Dr(e) {
|
|
|
2441
2462
|
}
|
|
2442
2463
|
return 0;
|
|
2443
2464
|
}
|
|
2444
|
-
function
|
|
2465
|
+
function Ar(e) {
|
|
2445
2466
|
let t = e;
|
|
2446
2467
|
for (; t;) {
|
|
2447
2468
|
if (!t.visible) return !1;
|
|
@@ -2449,23 +2470,23 @@ function Or(e) {
|
|
|
2449
2470
|
}
|
|
2450
2471
|
return !0;
|
|
2451
2472
|
}
|
|
2452
|
-
function
|
|
2453
|
-
if (!
|
|
2473
|
+
function jr(e) {
|
|
2474
|
+
if (!Ar(e.object) || !(e.object instanceof P) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
|
|
2454
2475
|
let t = e.object.geometry;
|
|
2455
2476
|
return !!(t.index && t.attributes.ids);
|
|
2456
2477
|
}
|
|
2457
|
-
function
|
|
2458
|
-
let r = l("end"), i = z((e) => e.selected), a = z((e) => e.setSelected), s = z((e) => e.addSelected), c = z((e) => e.removeSelected), u = z((e) => e.showStats), d =
|
|
2478
|
+
function Mr(e, t, n) {
|
|
2479
|
+
let r = l("end"), i = z((e) => e.selected), a = z((e) => e.setSelected), s = z((e) => e.addSelected), c = z((e) => e.removeSelected), u = z((e) => e.showStats), d = Ee(), f = l(null), m = l(null), h = l(!1), g = l(!1), _ = l("add"), v = l(null), y = l(!1), b = l(0), x = l(null), S = l(null), C = () => d.getState().selectionInteractionDisabled, w = (e) => {
|
|
2459
2480
|
let n = t.current;
|
|
2460
2481
|
n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
|
|
2461
2482
|
}, T = () => {
|
|
2462
2483
|
e.current?.traverse((e) => {
|
|
2463
2484
|
if (!(e instanceof P)) return;
|
|
2464
2485
|
let t = e;
|
|
2465
|
-
t.preselected = !1,
|
|
2486
|
+
t.preselected = !1, Dr(t.material, -1);
|
|
2466
2487
|
});
|
|
2467
2488
|
}, E = () => {
|
|
2468
|
-
f.current = null, h.current = !1,
|
|
2489
|
+
f.current = null, h.current = !1, wr(m), t.current && (t.current.enabled = !0);
|
|
2469
2490
|
}, D = (t) => {
|
|
2470
2491
|
if (C()) {
|
|
2471
2492
|
T();
|
|
@@ -2485,7 +2506,7 @@ function Ar(e, t, n) {
|
|
|
2485
2506
|
let t = e;
|
|
2486
2507
|
if (t !== i) return;
|
|
2487
2508
|
let r = n.faceIndex * 3, a = t.geometry.index.getX(r), o = t.geometry.attributes.ids.getX(a);
|
|
2488
|
-
t.preselected = !0,
|
|
2509
|
+
t.preselected = !0, Dr(t.material, o);
|
|
2489
2510
|
});
|
|
2490
2511
|
};
|
|
2491
2512
|
function O() {
|
|
@@ -2497,7 +2518,7 @@ function Ar(e, t, n) {
|
|
|
2497
2518
|
return;
|
|
2498
2519
|
}
|
|
2499
2520
|
if (S.current = e, x.current !== null) return;
|
|
2500
|
-
let t = O() - b.current, n = Math.max(0,
|
|
2521
|
+
let t = O() - b.current, n = Math.max(0, Tr - t);
|
|
2501
2522
|
x.current = window.setTimeout(() => {
|
|
2502
2523
|
x.current = null;
|
|
2503
2524
|
let e = S.current;
|
|
@@ -2534,10 +2555,10 @@ function Ar(e, t, n) {
|
|
|
2534
2555
|
r.current = "end";
|
|
2535
2556
|
return;
|
|
2536
2557
|
}
|
|
2537
|
-
let n = t.shiftKey, o = t.ctrlKey, l = ae(t, e.current), u, d =
|
|
2558
|
+
let n = t.shiftKey, o = t.ctrlKey, l = ae(t, e.current), u, d = Or(e), f = null;
|
|
2538
2559
|
if (l.length) {
|
|
2539
2560
|
let e = l[0], t = e.object;
|
|
2540
|
-
d =
|
|
2561
|
+
d = kr(t), f = e.point;
|
|
2541
2562
|
let n = e.faceIndex * 3, r = t.geometry.index.getX(n);
|
|
2542
2563
|
u = t.geometry.attributes.ids.getX(r);
|
|
2543
2564
|
}
|
|
@@ -2558,7 +2579,7 @@ function Ar(e, t, n) {
|
|
|
2558
2579
|
}
|
|
2559
2580
|
if (!f.current) return;
|
|
2560
2581
|
let t = new F(e.clientX, e.clientY), n = Math.abs(t.x - f.current.x), r = Math.abs(t.y - f.current.y);
|
|
2561
|
-
n < 6 && r < 6 || (h.current ||= !0, e.preventDefault(),
|
|
2582
|
+
n < 6 && r < 6 || (h.current ||= !0, e.preventDefault(), Cr(m, f.current, t));
|
|
2562
2583
|
}, ie = (r) => {
|
|
2563
2584
|
if (C()) {
|
|
2564
2585
|
E();
|
|
@@ -2566,12 +2587,12 @@ function Ar(e, t, n) {
|
|
|
2566
2587
|
}
|
|
2567
2588
|
if (!f.current) return;
|
|
2568
2589
|
A.current = M();
|
|
2569
|
-
let i = h.current, a = new F(r.clientX, r.clientY), o =
|
|
2570
|
-
if (f.current = null, h.current = !1,
|
|
2590
|
+
let i = h.current, a = new F(r.clientX, r.clientY), o = nr(f.current, a), l = rr(f.current, a);
|
|
2591
|
+
if (f.current = null, h.current = !1, wr(m), t.current && setTimeout(() => {
|
|
2571
2592
|
t.current && (t.current.enabled = !0);
|
|
2572
2593
|
}, 100), !i) return;
|
|
2573
2594
|
g.current = !0, r.preventDefault();
|
|
2574
|
-
let { ids: u, profile: d } =
|
|
2595
|
+
let { ids: u, profile: d } = xr({
|
|
2575
2596
|
model: e.current,
|
|
2576
2597
|
camera: ee,
|
|
2577
2598
|
clippingPlanes: n.getActiveClippingPlanes(),
|
|
@@ -2589,7 +2610,7 @@ function Ar(e, t, n) {
|
|
|
2589
2610
|
}));
|
|
2590
2611
|
}, ae = (e, t) => t ? n.getIntersection(!1, {
|
|
2591
2612
|
event: e,
|
|
2592
|
-
filter:
|
|
2613
|
+
filter: jr,
|
|
2593
2614
|
object: t,
|
|
2594
2615
|
recursive: !0
|
|
2595
2616
|
}) : [];
|
|
@@ -2612,29 +2633,29 @@ function Ar(e, t, n) {
|
|
|
2612
2633
|
e.ctrlKey && e.preventDefault();
|
|
2613
2634
|
}
|
|
2614
2635
|
return () => {
|
|
2615
|
-
|
|
2636
|
+
wr(m), x.current !== null && (window.clearTimeout(x.current), x.current = null), S.current = null, T(), e.removeEventListener("update", n), j.domElement.removeEventListener("pointerdown", ne), j.domElement.removeEventListener("pointermove", re), window.removeEventListener("pointerup", ie), window.removeEventListener("pointerup", N), j.domElement.removeEventListener("contextmenu", o), j.domElement.removeEventListener("pointerup", a), j.domElement.removeEventListener("pointerdown", i), j.domElement.removeEventListener("pointermove", k), j.domElement.removeEventListener("pointerleave", T);
|
|
2616
2637
|
};
|
|
2617
2638
|
});
|
|
2618
2639
|
}
|
|
2619
2640
|
//#endregion
|
|
2620
2641
|
//#region src/viewer/Camera/useCameraFit.tsx
|
|
2621
|
-
var
|
|
2622
|
-
function
|
|
2642
|
+
var Nr = new I(1, 1, 1).normalize(), Pr = 1.18;
|
|
2643
|
+
function Fr() {
|
|
2623
2644
|
let { camera: e } = p();
|
|
2624
2645
|
return i((t, n, r) => {
|
|
2625
2646
|
if (!t.current || !(e instanceof se)) return;
|
|
2626
2647
|
let i = new g().setFromObject(t.current);
|
|
2627
2648
|
if (i.isEmpty()) return;
|
|
2628
|
-
let a = i.getCenter(new I()), o = i.getBoundingSphere(new de()), s = te.degToRad(e.fov), c = 2 * Math.atan(Math.tan(s / 2) * e.aspect), l = Math.min(s, c), u = o.radius / Math.sin(l / 2) *
|
|
2629
|
-
e.position.copy(a).addScaledVector(
|
|
2649
|
+
let a = i.getCenter(new I()), o = i.getBoundingSphere(new de()), s = te.degToRad(e.fov), c = 2 * Math.atan(Math.tan(s / 2) * e.aspect), l = Math.min(s, c), u = o.radius / Math.sin(l / 2) * Pr;
|
|
2650
|
+
e.position.copy(a).addScaledVector(Nr, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix();
|
|
2630
2651
|
let d = n.current;
|
|
2631
|
-
d && (d.cancel(), d.setFocalOffset(0, 0, 0, !1), d.setLookAt(e.position.x, e.position.y, e.position.z, a.x, a.y, a.z, !1)), r.current && (r.current.position.copy(a).addScaledVector(
|
|
2652
|
+
d && (d.cancel(), d.setFocalOffset(0, 0, 0, !1), d.setLookAt(e.position.x, e.position.y, e.position.z, a.x, a.y, a.z, !1)), r.current && (r.current.position.copy(a).addScaledVector(Nr, u * .8), r.current.lookAt(a));
|
|
2632
2653
|
}, [e]);
|
|
2633
2654
|
}
|
|
2634
2655
|
//#endregion
|
|
2635
2656
|
//#region src/viewer/store/ViewerStoreProvider.tsx
|
|
2636
|
-
function
|
|
2637
|
-
let [n] = u(() => t ??
|
|
2657
|
+
function Ir({ children: e, store: t }) {
|
|
2658
|
+
let [n] = u(() => t ?? Ae());
|
|
2638
2659
|
return /* @__PURE__ */ L(Te.Provider, {
|
|
2639
2660
|
value: n,
|
|
2640
2661
|
children: e
|
|
@@ -2642,19 +2663,19 @@ function Pr({ children: e, store: t }) {
|
|
|
2642
2663
|
}
|
|
2643
2664
|
//#endregion
|
|
2644
2665
|
//#region src/viewer/utils/ExportUtils/ExportUtils.ts
|
|
2645
|
-
var
|
|
2646
|
-
function
|
|
2666
|
+
var Lr = new TextEncoder(), Rr = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", zr = "Unknown", Br = ["elementID", "ifcguid"], Vr = 0, Hr = 33;
|
|
2667
|
+
function Ur(e) {
|
|
2647
2668
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
2648
2669
|
}
|
|
2649
|
-
function
|
|
2650
|
-
return e == null ? t : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "number" ? Number.isFinite(e) ? String(e) : t : typeof e == "string" ? e.trim() ? e : t :
|
|
2670
|
+
function Wr(e, t) {
|
|
2671
|
+
return e == null ? t : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "number" ? Number.isFinite(e) ? String(e) : t : typeof e == "string" ? e.trim() ? e : t : Ur(e) && "value" in e ? Wr(e.value, t) : null;
|
|
2651
2672
|
}
|
|
2652
|
-
function
|
|
2653
|
-
let n =
|
|
2673
|
+
function Gr(e, t) {
|
|
2674
|
+
let n = Wr(e, t);
|
|
2654
2675
|
if (n !== null) return n;
|
|
2655
2676
|
if (Array.isArray(e)) {
|
|
2656
2677
|
if (!e.length) return t;
|
|
2657
|
-
let n = e.map((e) =>
|
|
2678
|
+
let n = e.map((e) => Wr(e, t));
|
|
2658
2679
|
if (n.every((e) => e !== null)) {
|
|
2659
2680
|
let e = n.join(", ");
|
|
2660
2681
|
return e.trim() ? e : t;
|
|
@@ -2667,21 +2688,21 @@ function Ur(e, t) {
|
|
|
2667
2688
|
return t;
|
|
2668
2689
|
}
|
|
2669
2690
|
}
|
|
2670
|
-
function
|
|
2691
|
+
function K(e) {
|
|
2671
2692
|
return typeof e == "string" && e.trim() ? e : null;
|
|
2672
2693
|
}
|
|
2673
|
-
function
|
|
2674
|
-
let t =
|
|
2675
|
-
return
|
|
2694
|
+
function Kr(e) {
|
|
2695
|
+
let t = Ur(e.props) ? e.props : {};
|
|
2696
|
+
return K(e.type ?? e.Type ?? t.type ?? t.Type) ?? zr;
|
|
2676
2697
|
}
|
|
2677
|
-
function
|
|
2678
|
-
let t =
|
|
2679
|
-
return
|
|
2698
|
+
function qr(e) {
|
|
2699
|
+
let t = Ur(e.props) ? e.props : {};
|
|
2700
|
+
return K(e.guid ?? e.GlobalId ?? e.globalId ?? t.guid ?? t.GlobalId ?? t.globalId) ?? "";
|
|
2680
2701
|
}
|
|
2681
|
-
function
|
|
2682
|
-
return
|
|
2702
|
+
function Jr(e, t) {
|
|
2703
|
+
return K(e.Name) ?? K(e.name) ?? K(e.DisplayName) ?? K(e.displayName) ?? `Property ${t + 1}`;
|
|
2683
2704
|
}
|
|
2684
|
-
function
|
|
2705
|
+
function Yr(e) {
|
|
2685
2706
|
for (let t of [
|
|
2686
2707
|
"NominalValue",
|
|
2687
2708
|
"nominalValue",
|
|
@@ -2704,18 +2725,18 @@ function qr(e) {
|
|
|
2704
2725
|
"description"
|
|
2705
2726
|
].includes(e)));
|
|
2706
2727
|
}
|
|
2707
|
-
function
|
|
2708
|
-
return
|
|
2728
|
+
function Xr(e, t) {
|
|
2729
|
+
return K(e.name) ?? K(e.Name) ?? `Set ${t + 1}`;
|
|
2709
2730
|
}
|
|
2710
|
-
function
|
|
2731
|
+
function Zr(e) {
|
|
2711
2732
|
let t = e.props;
|
|
2712
|
-
return Array.isArray(t) ? t.map((e, t) =>
|
|
2713
|
-
label:
|
|
2714
|
-
value:
|
|
2733
|
+
return Array.isArray(t) ? t.map((e, t) => Ur(e) ? {
|
|
2734
|
+
label: Jr(e, t),
|
|
2735
|
+
value: Yr(e)
|
|
2715
2736
|
} : {
|
|
2716
2737
|
label: `Property ${t + 1}`,
|
|
2717
2738
|
value: e
|
|
2718
|
-
}) :
|
|
2739
|
+
}) : Ur(t) ? Object.entries(t).map(([e, t]) => ({
|
|
2719
2740
|
label: e,
|
|
2720
2741
|
value: t
|
|
2721
2742
|
})) : Object.entries(e).filter(([e]) => ![
|
|
@@ -2729,14 +2750,14 @@ function Yr(e) {
|
|
|
2729
2750
|
value: t
|
|
2730
2751
|
}));
|
|
2731
2752
|
}
|
|
2732
|
-
function
|
|
2753
|
+
function Qr(e, t) {
|
|
2733
2754
|
e.columnSet.has(t) || (e.columnSet.add(t), e.columns.push(t));
|
|
2734
2755
|
}
|
|
2735
|
-
function
|
|
2756
|
+
function $r(e, t, n, r, i) {
|
|
2736
2757
|
let a = n.trim();
|
|
2737
|
-
a && (
|
|
2758
|
+
a && (Qr(e, a), t[a] = Gr(r, i));
|
|
2738
2759
|
}
|
|
2739
|
-
function
|
|
2760
|
+
function ei(e, t, n) {
|
|
2740
2761
|
let r = {};
|
|
2741
2762
|
return Object.entries(t).forEach(([t, i]) => {
|
|
2742
2763
|
[
|
|
@@ -2744,33 +2765,33 @@ function Qr(e, t, n) {
|
|
|
2744
2765
|
"guid",
|
|
2745
2766
|
"props",
|
|
2746
2767
|
"sets"
|
|
2747
|
-
].includes(t) ||
|
|
2748
|
-
}),
|
|
2749
|
-
|
|
2768
|
+
].includes(t) || $r(e, r, t, i, n);
|
|
2769
|
+
}), Ur(t.props) && Object.entries(t.props).forEach(([t, i]) => {
|
|
2770
|
+
$r(e, r, t, i, n);
|
|
2750
2771
|
}), Array.isArray(t.sets) && t.sets.forEach((t, i) => {
|
|
2751
|
-
let a =
|
|
2752
|
-
|
|
2753
|
-
|
|
2772
|
+
let a = Xr(t, i);
|
|
2773
|
+
Zr(t).forEach((t) => {
|
|
2774
|
+
$r(e, r, `${a}.${t.label}`, t.value, n);
|
|
2754
2775
|
});
|
|
2755
2776
|
}), r;
|
|
2756
2777
|
}
|
|
2757
|
-
function
|
|
2778
|
+
function ti(e, t, n) {
|
|
2758
2779
|
Object.entries(t).forEach(([t, r]) => {
|
|
2759
2780
|
let i = Number(t);
|
|
2760
2781
|
if (!Number.isFinite(i)) return;
|
|
2761
|
-
let a =
|
|
2782
|
+
let a = Kr(r), o = e.get(a);
|
|
2762
2783
|
o || (o = {
|
|
2763
2784
|
columns: [],
|
|
2764
2785
|
columnSet: /* @__PURE__ */ new Set(),
|
|
2765
2786
|
rows: []
|
|
2766
2787
|
}, e.set(a, o)), o.rows.push({
|
|
2767
2788
|
elementID: i,
|
|
2768
|
-
ifcguid:
|
|
2769
|
-
values:
|
|
2789
|
+
ifcguid: qr(r),
|
|
2790
|
+
values: ei(o, r, n)
|
|
2770
2791
|
});
|
|
2771
2792
|
});
|
|
2772
2793
|
}
|
|
2773
|
-
function
|
|
2794
|
+
function ni(e) {
|
|
2774
2795
|
return e.replace(/[<>&'"]/g, (e) => {
|
|
2775
2796
|
switch (e) {
|
|
2776
2797
|
case "<": return "<";
|
|
@@ -2782,7 +2803,7 @@ function ei(e) {
|
|
|
2782
2803
|
}
|
|
2783
2804
|
});
|
|
2784
2805
|
}
|
|
2785
|
-
function
|
|
2806
|
+
function ri(e) {
|
|
2786
2807
|
let t = e, n = "";
|
|
2787
2808
|
for (; t > 0;) {
|
|
2788
2809
|
let e = (t - 1) % 26;
|
|
@@ -2790,45 +2811,45 @@ function ti(e) {
|
|
|
2790
2811
|
}
|
|
2791
2812
|
return n;
|
|
2792
2813
|
}
|
|
2793
|
-
function
|
|
2794
|
-
return `<c r="${`${
|
|
2814
|
+
function ii(e, t, n) {
|
|
2815
|
+
return `<c r="${`${ri(n)}${t}`}" t="inlineStr"><is><t${/^\s|\s$/.test(e) ? " xml:space=\"preserve\"" : ""}>${ni(e)}</t></is></c>`;
|
|
2795
2816
|
}
|
|
2796
|
-
function
|
|
2797
|
-
return `${
|
|
2817
|
+
function ai(e) {
|
|
2818
|
+
return `${Rr}<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><sheetData>${e.map((e, t) => {
|
|
2798
2819
|
let n = t + 1;
|
|
2799
|
-
return `<row r="${n}">${e.map((e, t) =>
|
|
2820
|
+
return `<row r="${n}">${e.map((e, t) => ii(e, n, t + 1)).join("")}</row>`;
|
|
2800
2821
|
}).join("")}</sheetData></worksheet>`;
|
|
2801
2822
|
}
|
|
2802
|
-
function
|
|
2803
|
-
return e.replace(/[\\/?*[\]:]/g, " ").trim() ||
|
|
2823
|
+
function oi(e) {
|
|
2824
|
+
return e.replace(/[\\/?*[\]:]/g, " ").trim() || zr;
|
|
2804
2825
|
}
|
|
2805
|
-
function
|
|
2806
|
-
let n =
|
|
2826
|
+
function si(e, t) {
|
|
2827
|
+
let n = oi(e).slice(0, 31), r = n, i = 2;
|
|
2807
2828
|
for (; t.has(r.toLowerCase());) {
|
|
2808
2829
|
let e = ` (${i})`;
|
|
2809
2830
|
r = `${n.slice(0, 31 - e.length)}${e}`, i += 1;
|
|
2810
2831
|
}
|
|
2811
2832
|
return t.add(r.toLowerCase()), r;
|
|
2812
2833
|
}
|
|
2813
|
-
function
|
|
2814
|
-
return `${
|
|
2834
|
+
function ci(e) {
|
|
2835
|
+
return `${Rr}<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><sheets>${e.map((e, t) => {
|
|
2815
2836
|
let n = t + 1;
|
|
2816
|
-
return `<sheet name="${
|
|
2837
|
+
return `<sheet name="${ni(e)}" sheetId="${n}" r:id="rId${n}"/>`;
|
|
2817
2838
|
}).join("")}</sheets></workbook>`;
|
|
2818
2839
|
}
|
|
2819
|
-
function
|
|
2820
|
-
return `${
|
|
2840
|
+
function li(e) {
|
|
2841
|
+
return `${Rr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((e, t) => {
|
|
2821
2842
|
let n = t + 1;
|
|
2822
2843
|
return `<Relationship Id="rId${n}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${n}.xml"/>`;
|
|
2823
2844
|
}).join("")}</Relationships>`;
|
|
2824
2845
|
}
|
|
2825
|
-
function
|
|
2826
|
-
return `${
|
|
2846
|
+
function ui() {
|
|
2847
|
+
return `${Rr}<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`;
|
|
2827
2848
|
}
|
|
2828
|
-
function
|
|
2829
|
-
return `${
|
|
2849
|
+
function di(e) {
|
|
2850
|
+
return `${Rr}<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>${e.map((e, t) => `<Override PartName="/xl/worksheets/sheet${t + 1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}</Types>`;
|
|
2830
2851
|
}
|
|
2831
|
-
function
|
|
2852
|
+
function fi() {
|
|
2832
2853
|
let e = new Uint32Array(256);
|
|
2833
2854
|
for (let t = 0; t < 256; t++) {
|
|
2834
2855
|
let n = t;
|
|
@@ -2837,118 +2858,121 @@ function ui() {
|
|
|
2837
2858
|
}
|
|
2838
2859
|
return e;
|
|
2839
2860
|
}
|
|
2840
|
-
var
|
|
2841
|
-
function
|
|
2861
|
+
var pi = fi();
|
|
2862
|
+
function mi(e) {
|
|
2842
2863
|
let t = 4294967295;
|
|
2843
|
-
for (let n of e) t =
|
|
2864
|
+
for (let n of e) t = pi[(t ^ n) & 255] ^ t >>> 8;
|
|
2844
2865
|
return (t ^ 4294967295) >>> 0;
|
|
2845
2866
|
}
|
|
2846
|
-
function
|
|
2867
|
+
function hi(e) {
|
|
2847
2868
|
let t = new Uint8Array(30 + e.nameBytes.length), n = new DataView(t.buffer);
|
|
2848
|
-
return n.setUint32(0, 67324752, !0), n.setUint16(4, 20, !0), n.setUint16(6, 0, !0), n.setUint16(8, 0, !0), n.setUint16(10,
|
|
2869
|
+
return n.setUint32(0, 67324752, !0), n.setUint16(4, 20, !0), n.setUint16(6, 0, !0), n.setUint16(8, 0, !0), n.setUint16(10, Vr, !0), n.setUint16(12, Hr, !0), n.setUint32(14, e.crc, !0), n.setUint32(18, e.data.length, !0), n.setUint32(22, e.data.length, !0), n.setUint16(26, e.nameBytes.length, !0), n.setUint16(28, 0, !0), t.set(e.nameBytes, 30), t;
|
|
2849
2870
|
}
|
|
2850
|
-
function
|
|
2871
|
+
function gi(e) {
|
|
2851
2872
|
let t = new Uint8Array(46 + e.nameBytes.length), n = new DataView(t.buffer);
|
|
2852
|
-
return n.setUint32(0, 33639248, !0), n.setUint16(4, 20, !0), n.setUint16(6, 20, !0), n.setUint16(8, 0, !0), n.setUint16(10, 0, !0), n.setUint16(12,
|
|
2873
|
+
return n.setUint32(0, 33639248, !0), n.setUint16(4, 20, !0), n.setUint16(6, 20, !0), n.setUint16(8, 0, !0), n.setUint16(10, 0, !0), n.setUint16(12, Vr, !0), n.setUint16(14, Hr, !0), n.setUint32(16, e.crc, !0), n.setUint32(20, e.data.length, !0), n.setUint32(24, e.data.length, !0), n.setUint16(28, e.nameBytes.length, !0), n.setUint16(30, 0, !0), n.setUint16(32, 0, !0), n.setUint16(34, 0, !0), n.setUint16(36, 0, !0), n.setUint32(38, 0, !0), n.setUint32(42, e.offset, !0), t.set(e.nameBytes, 46), t;
|
|
2853
2874
|
}
|
|
2854
|
-
function
|
|
2875
|
+
function _i(e, t, n) {
|
|
2855
2876
|
let r = new Uint8Array(22), i = new DataView(r.buffer);
|
|
2856
2877
|
return i.setUint32(0, 101010256, !0), i.setUint16(4, 0, !0), i.setUint16(6, 0, !0), i.setUint16(8, e, !0), i.setUint16(10, e, !0), i.setUint32(12, t, !0), i.setUint32(16, n, !0), i.setUint16(20, 0, !0), r;
|
|
2857
2878
|
}
|
|
2858
|
-
function
|
|
2879
|
+
function vi(e, t) {
|
|
2859
2880
|
let n = new Uint8Array(t), r = 0;
|
|
2860
2881
|
return e.forEach((e) => {
|
|
2861
2882
|
n.set(e, r), r += e.length;
|
|
2862
2883
|
}), n;
|
|
2863
2884
|
}
|
|
2864
|
-
function
|
|
2885
|
+
function yi(e) {
|
|
2865
2886
|
let t = 0, n = e.map((e) => {
|
|
2866
2887
|
let n = {
|
|
2867
2888
|
...e,
|
|
2868
|
-
crc:
|
|
2869
|
-
nameBytes:
|
|
2889
|
+
crc: mi(e.data),
|
|
2890
|
+
nameBytes: Lr.encode(e.path),
|
|
2870
2891
|
offset: t
|
|
2871
2892
|
};
|
|
2872
2893
|
return t += 30 + n.nameBytes.length + n.data.length, n;
|
|
2873
2894
|
}), r = [];
|
|
2874
2895
|
n.forEach((e) => {
|
|
2875
|
-
r.push(
|
|
2896
|
+
r.push(hi(e), e.data);
|
|
2876
2897
|
});
|
|
2877
2898
|
let i = t, a = 0;
|
|
2878
2899
|
return n.forEach((e) => {
|
|
2879
|
-
let t =
|
|
2900
|
+
let t = gi(e);
|
|
2880
2901
|
a += t.length, r.push(t);
|
|
2881
|
-
}), r.push(
|
|
2902
|
+
}), r.push(_i(n.length, a, i)), vi(r, r.reduce((e, t) => e + t.length, 0));
|
|
2882
2903
|
}
|
|
2883
|
-
function
|
|
2904
|
+
function bi(e, t) {
|
|
2884
2905
|
let n = /* @__PURE__ */ new Map();
|
|
2885
|
-
e &&
|
|
2906
|
+
e && ti(n, e.props, t);
|
|
2886
2907
|
let r = /* @__PURE__ */ new Set(), i = Array.from(n.entries()).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
|
|
2887
|
-
let i = [...
|
|
2908
|
+
let i = [...Br, ...n.columns], a = n.rows.sort((e, t) => e.elementID - t.elementID).map((e) => [
|
|
2888
2909
|
String(e.elementID),
|
|
2889
2910
|
e.ifcguid || t,
|
|
2890
2911
|
...n.columns.map((n) => e.values[n] ?? t)
|
|
2891
2912
|
]);
|
|
2892
2913
|
return {
|
|
2893
|
-
name:
|
|
2914
|
+
name: si(e, r),
|
|
2894
2915
|
rows: [i, ...a]
|
|
2895
2916
|
};
|
|
2896
2917
|
});
|
|
2897
2918
|
return i.length || i.push({
|
|
2898
|
-
name:
|
|
2899
|
-
rows: [
|
|
2919
|
+
name: si(zr, r),
|
|
2920
|
+
rows: [Br]
|
|
2900
2921
|
}), i;
|
|
2901
2922
|
}
|
|
2902
|
-
function
|
|
2903
|
-
let n =
|
|
2923
|
+
function xi(e, t = {}) {
|
|
2924
|
+
let n = bi(e, t.emptyValue ?? "-"), r = n.map((e) => e.name), i = [
|
|
2904
2925
|
{
|
|
2905
2926
|
path: "[Content_Types].xml",
|
|
2906
|
-
data:
|
|
2927
|
+
data: Lr.encode(di(r))
|
|
2907
2928
|
},
|
|
2908
2929
|
{
|
|
2909
2930
|
path: "_rels/.rels",
|
|
2910
|
-
data:
|
|
2931
|
+
data: Lr.encode(ui())
|
|
2911
2932
|
},
|
|
2912
2933
|
{
|
|
2913
2934
|
path: "xl/workbook.xml",
|
|
2914
|
-
data:
|
|
2935
|
+
data: Lr.encode(ci(r))
|
|
2915
2936
|
},
|
|
2916
2937
|
{
|
|
2917
2938
|
path: "xl/_rels/workbook.xml.rels",
|
|
2918
|
-
data:
|
|
2939
|
+
data: Lr.encode(li(r))
|
|
2919
2940
|
},
|
|
2920
2941
|
...n.map((e, t) => ({
|
|
2921
2942
|
path: `xl/worksheets/sheet${t + 1}.xml`,
|
|
2922
|
-
data:
|
|
2943
|
+
data: Lr.encode(ai(e.rows))
|
|
2923
2944
|
}))
|
|
2924
2945
|
];
|
|
2925
|
-
return new Blob([
|
|
2946
|
+
return new Blob([yi(i)], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" });
|
|
2926
2947
|
}
|
|
2927
|
-
function
|
|
2948
|
+
function Si(e) {
|
|
2928
2949
|
return e.split(/[?#]/)[0].split(/[\\/]/).pop()?.replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "").trim() || "model";
|
|
2929
2950
|
}
|
|
2930
|
-
function
|
|
2931
|
-
let n = t.fileName?.trim() || `${
|
|
2951
|
+
function Ci(e, t) {
|
|
2952
|
+
let n = t.fileName?.trim() || `${Si(t.modelName ?? e?.name ?? "model")}_properties`;
|
|
2932
2953
|
return n.toLowerCase().endsWith(".xlsx") ? n : `${n}.xlsx`;
|
|
2933
2954
|
}
|
|
2934
|
-
function
|
|
2955
|
+
function wi(e, t = {}) {
|
|
2935
2956
|
return {
|
|
2936
|
-
blob:
|
|
2937
|
-
name:
|
|
2957
|
+
blob: xi(e, t),
|
|
2958
|
+
name: Ci(e, t)
|
|
2938
2959
|
};
|
|
2939
2960
|
}
|
|
2940
2961
|
//#endregion
|
|
2941
2962
|
//#region src/viewer/api/ViewerPropertiesApi.ts
|
|
2942
|
-
function
|
|
2963
|
+
function q(e) {
|
|
2943
2964
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
2944
2965
|
}
|
|
2945
|
-
function
|
|
2946
|
-
return
|
|
2947
|
-
}
|
|
2948
|
-
function Ti(e) {
|
|
2949
|
-
return Array.isArray(e) ? e.filter(wi) : Ci(e) ? Object.values(e).filter(wi) : [];
|
|
2966
|
+
function Ti(e, t) {
|
|
2967
|
+
return Object.prototype.hasOwnProperty.call(e, t);
|
|
2950
2968
|
}
|
|
2951
2969
|
function Ei(e) {
|
|
2970
|
+
return q(e);
|
|
2971
|
+
}
|
|
2972
|
+
function Di(e) {
|
|
2973
|
+
return Array.isArray(e) ? e.filter(Ei) : q(e) ? Object.values(e).filter(Ei) : [];
|
|
2974
|
+
}
|
|
2975
|
+
function Oi(e) {
|
|
2952
2976
|
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
2953
2977
|
if (typeof e == "string") {
|
|
2954
2978
|
let t = Number(e);
|
|
@@ -2956,10 +2980,10 @@ function Ei(e) {
|
|
|
2956
2980
|
}
|
|
2957
2981
|
return null;
|
|
2958
2982
|
}
|
|
2959
|
-
function
|
|
2960
|
-
return
|
|
2983
|
+
function ki(e) {
|
|
2984
|
+
return Oi(e.id ?? e.expressID ?? e.expressId ?? e.elementID ?? e.elementId);
|
|
2961
2985
|
}
|
|
2962
|
-
function
|
|
2986
|
+
function Ai(e) {
|
|
2963
2987
|
let t = [
|
|
2964
2988
|
e.children,
|
|
2965
2989
|
e.items,
|
|
@@ -2967,40 +2991,40 @@ function Oi(e) {
|
|
|
2967
2991
|
e.childs
|
|
2968
2992
|
];
|
|
2969
2993
|
for (let e of t) {
|
|
2970
|
-
let t =
|
|
2994
|
+
let t = Di(e);
|
|
2971
2995
|
if (t.length) return t;
|
|
2972
2996
|
}
|
|
2973
2997
|
return [];
|
|
2974
2998
|
}
|
|
2975
|
-
function
|
|
2976
|
-
let t =
|
|
2999
|
+
function ji(e) {
|
|
3000
|
+
let t = q(e.props) ? e.props : {}, n = e.type ?? e.Type ?? t.type ?? t.Type;
|
|
2977
3001
|
return typeof n == "string" ? n : "";
|
|
2978
3002
|
}
|
|
2979
|
-
function
|
|
3003
|
+
function Mi(e) {
|
|
2980
3004
|
return e.replace(/[^a-z0-9]/gi, "").toUpperCase();
|
|
2981
3005
|
}
|
|
2982
|
-
function
|
|
2983
|
-
return
|
|
3006
|
+
function Ni(e) {
|
|
3007
|
+
return Mi(ji(e)) === "IFCBUILDINGSTOREY";
|
|
2984
3008
|
}
|
|
2985
|
-
var
|
|
3009
|
+
var Pi = new Set([
|
|
2986
3010
|
"children",
|
|
2987
3011
|
"childs",
|
|
2988
3012
|
"elements",
|
|
2989
3013
|
"items"
|
|
2990
3014
|
]);
|
|
2991
|
-
function
|
|
3015
|
+
function Fi(e) {
|
|
2992
3016
|
let t = {};
|
|
2993
3017
|
return Object.entries(e).forEach(([e, n]) => {
|
|
2994
|
-
|
|
3018
|
+
Pi.has(e) || (t[e] = n);
|
|
2995
3019
|
}), t;
|
|
2996
3020
|
}
|
|
2997
|
-
function
|
|
3021
|
+
function Ii(e, t) {
|
|
2998
3022
|
return Array.isArray(t) ? {
|
|
2999
|
-
children:
|
|
3023
|
+
children: Di(t),
|
|
3000
3024
|
name: `Model ${e}`,
|
|
3001
3025
|
type: "Model"
|
|
3002
|
-
} :
|
|
3003
|
-
children:
|
|
3026
|
+
} : q(t) ? ki(t) !== null || typeof t.name == "string" || typeof t.Name == "string" || typeof t.type == "string" || typeof t.Type == "string" || Array.isArray(t.children) ? t : {
|
|
3027
|
+
children: Di(t),
|
|
3004
3028
|
name: `Model ${e}`,
|
|
3005
3029
|
type: "Model"
|
|
3006
3030
|
} : {
|
|
@@ -3009,37 +3033,106 @@ function Pi(e, t) {
|
|
|
3009
3033
|
type: "Model"
|
|
3010
3034
|
};
|
|
3011
3035
|
}
|
|
3012
|
-
function
|
|
3036
|
+
function Li(e) {
|
|
3013
3037
|
let t = [];
|
|
3014
|
-
return
|
|
3015
|
-
let n =
|
|
3016
|
-
n !== null && t.push(n), t.push(...
|
|
3038
|
+
return Ai(e).forEach((e) => {
|
|
3039
|
+
let n = ki(e);
|
|
3040
|
+
n !== null && t.push(n), t.push(...Li(e));
|
|
3017
3041
|
}), t;
|
|
3018
3042
|
}
|
|
3019
|
-
function
|
|
3020
|
-
let i =
|
|
3021
|
-
...
|
|
3043
|
+
function Ri(e, t, n, r) {
|
|
3044
|
+
let i = ki(t), a = i === null ? void 0 : n[e]?.[i], o = {
|
|
3045
|
+
...Fi(t),
|
|
3022
3046
|
...a ?? {},
|
|
3023
3047
|
modelID: e
|
|
3024
3048
|
};
|
|
3025
|
-
return r && (o.elements =
|
|
3049
|
+
return r && (o.elements = Li(t)), o;
|
|
3026
3050
|
}
|
|
3027
|
-
function
|
|
3028
|
-
|
|
3051
|
+
function zi(e, t, n, r, i) {
|
|
3052
|
+
Ni(t) && n.push(Ri(e, t, r, i)), Ai(t).forEach((t) => zi(e, t, n, r, i));
|
|
3029
3053
|
}
|
|
3030
|
-
function
|
|
3054
|
+
function Bi(e, t, n = !1) {
|
|
3031
3055
|
let r = {};
|
|
3032
3056
|
return Object.entries(e).forEach(([e, i]) => {
|
|
3033
3057
|
let a = Number(e), o = [];
|
|
3034
|
-
|
|
3058
|
+
zi(a, Ii(a, i), o, t, n), r[a] = o;
|
|
3035
3059
|
}), r;
|
|
3036
3060
|
}
|
|
3037
|
-
function
|
|
3061
|
+
function Vi(e, t, n, r = !1) {
|
|
3038
3062
|
let i = [], a = e[n];
|
|
3039
3063
|
if (!a) throw Error(`Model with modelID ${n} not found`);
|
|
3040
|
-
return
|
|
3064
|
+
return zi(Number(n), Ii(Number(n), a), i, t, r), i;
|
|
3041
3065
|
}
|
|
3042
|
-
function
|
|
3066
|
+
function Hi(e, t, n) {
|
|
3067
|
+
return e[t]?.[n];
|
|
3068
|
+
}
|
|
3069
|
+
function Ui(e) {
|
|
3070
|
+
return typeof e == "string" ? e : q(e) && typeof e.value == "string" ? e.value : "";
|
|
3071
|
+
}
|
|
3072
|
+
function Wi(e, t) {
|
|
3073
|
+
return Ui(e.Name) || Ui(e.name) || Ui(e.DisplayName) || Ui(e.displayName) || `Property ${t + 1}`;
|
|
3074
|
+
}
|
|
3075
|
+
function Gi(e) {
|
|
3076
|
+
for (let t of [
|
|
3077
|
+
"NominalValue",
|
|
3078
|
+
"nominalValue",
|
|
3079
|
+
"Value",
|
|
3080
|
+
"value",
|
|
3081
|
+
"LengthValue",
|
|
3082
|
+
"AreaValue",
|
|
3083
|
+
"VolumeValue",
|
|
3084
|
+
"CountValue",
|
|
3085
|
+
"WeightValue",
|
|
3086
|
+
"TimeValue",
|
|
3087
|
+
"IntegerValue",
|
|
3088
|
+
"RealValue",
|
|
3089
|
+
"BooleanValue"
|
|
3090
|
+
]) if (e[t] !== void 0) return e[t];
|
|
3091
|
+
return Object.fromEntries(Object.entries(e).filter(([e]) => ![
|
|
3092
|
+
"Name",
|
|
3093
|
+
"name",
|
|
3094
|
+
"Description",
|
|
3095
|
+
"description"
|
|
3096
|
+
].includes(e)));
|
|
3097
|
+
}
|
|
3098
|
+
function Ki(e) {
|
|
3099
|
+
return Ui(e.name) || Ui(e.Name);
|
|
3100
|
+
}
|
|
3101
|
+
function qi(e, t) {
|
|
3102
|
+
return Ti(e, t) ? e[t] : void 0;
|
|
3103
|
+
}
|
|
3104
|
+
function Ji(e, t) {
|
|
3105
|
+
let n = e.props;
|
|
3106
|
+
if (q(n)) {
|
|
3107
|
+
let e = qi(n, t);
|
|
3108
|
+
if (e !== void 0) return e;
|
|
3109
|
+
}
|
|
3110
|
+
if (Array.isArray(n)) for (let e = 0; e < n.length; e += 1) {
|
|
3111
|
+
let r = n[e];
|
|
3112
|
+
if (!q(r)) continue;
|
|
3113
|
+
let i = r;
|
|
3114
|
+
if (Wi(i, e) === t) return Gi(i);
|
|
3115
|
+
}
|
|
3116
|
+
return qi(e, t);
|
|
3117
|
+
}
|
|
3118
|
+
function Yi(e, t, n) {
|
|
3119
|
+
if (!e) return;
|
|
3120
|
+
if (n !== void 0) {
|
|
3121
|
+
let r = e.sets?.find((e) => Ki(e) === n);
|
|
3122
|
+
return r ? Ji(r, t) : void 0;
|
|
3123
|
+
}
|
|
3124
|
+
if (q(e.props)) {
|
|
3125
|
+
let n = qi(e.props, t);
|
|
3126
|
+
if (n !== void 0) return n;
|
|
3127
|
+
}
|
|
3128
|
+
let r = qi(e, t);
|
|
3129
|
+
if (r !== void 0) return r;
|
|
3130
|
+
for (let n of e.sets ?? []) {
|
|
3131
|
+
let e = Ji(n, t);
|
|
3132
|
+
if (e !== void 0) return e;
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
function Xi(e, t, n, r) {
|
|
3043
3136
|
let i = t[e];
|
|
3044
3137
|
return i ? {
|
|
3045
3138
|
data: {},
|
|
@@ -3048,41 +3141,44 @@ function Bi(e, t, n, r) {
|
|
|
3048
3141
|
structure: n[e] ?? {}
|
|
3049
3142
|
} : null;
|
|
3050
3143
|
}
|
|
3051
|
-
function
|
|
3144
|
+
function Zi(e) {
|
|
3052
3145
|
return {
|
|
3053
3146
|
exportAllExcel: (t) => {
|
|
3054
3147
|
let n = e.getState();
|
|
3055
3148
|
return Object.keys(n.modelProps).flatMap((e) => {
|
|
3056
|
-
let r =
|
|
3057
|
-
return r ? [
|
|
3149
|
+
let r = Xi(Number(e), n.modelProps, n.modelStructure, n.modelNames);
|
|
3150
|
+
return r ? [wi(r, t)] : [];
|
|
3058
3151
|
});
|
|
3059
3152
|
},
|
|
3060
3153
|
exportExcel: (t, n) => {
|
|
3061
|
-
let r = e.getState(), i =
|
|
3062
|
-
return i ?
|
|
3154
|
+
let r = e.getState(), i = Xi(t, r.modelProps, r.modelStructure, r.modelNames);
|
|
3155
|
+
return i ? wi(i, n) : null;
|
|
3063
3156
|
},
|
|
3064
3157
|
getAllLevels: (t = !1) => {
|
|
3065
3158
|
let n = e.getState();
|
|
3066
|
-
return
|
|
3159
|
+
return Bi(n.modelStructure, n.modelProps, t);
|
|
3067
3160
|
},
|
|
3068
3161
|
getAllModelLevels: (t, n = !1) => {
|
|
3069
3162
|
let r = e.getState();
|
|
3070
|
-
return
|
|
3163
|
+
return Vi(r.modelStructure, r.modelProps, t, n);
|
|
3071
3164
|
},
|
|
3072
3165
|
getModelProps: () => e.getState().modelProps,
|
|
3073
|
-
getModelStructure: () => e.getState().modelStructure
|
|
3166
|
+
getModelStructure: () => e.getState().modelStructure,
|
|
3167
|
+
getParamsByElement: (t, n) => Hi(e.getState().modelProps, t, n),
|
|
3168
|
+
getParamValueByName: Yi,
|
|
3169
|
+
getParamValueByElement: (t, n, r, i) => Yi(Hi(e.getState().modelProps, t, n), r, i)
|
|
3074
3170
|
};
|
|
3075
3171
|
}
|
|
3076
3172
|
//#endregion
|
|
3077
3173
|
//#region src/viewer/Loaders/BmtConverter.ts
|
|
3078
|
-
var
|
|
3174
|
+
var Qi = "BMT", $i = 1, J = {
|
|
3079
3175
|
PROP: 1,
|
|
3080
3176
|
MESH: 2,
|
|
3081
3177
|
STRUCTURE: 3,
|
|
3082
3178
|
GRIDS: 4,
|
|
3083
3179
|
MATRIX: 5,
|
|
3084
3180
|
MESHSPACE: 6
|
|
3085
|
-
},
|
|
3181
|
+
}, ea = "application/json", ta = "application/octet-stream", na = class {
|
|
3086
3182
|
chunks = [];
|
|
3087
3183
|
length = 0;
|
|
3088
3184
|
writeUint8(e) {
|
|
@@ -3102,7 +3198,7 @@ var Hi = "BMT", Ui = 1, J = {
|
|
|
3102
3198
|
e.set(n, t), t += n.byteLength;
|
|
3103
3199
|
}), e;
|
|
3104
3200
|
}
|
|
3105
|
-
},
|
|
3201
|
+
}, ra = class {
|
|
3106
3202
|
textEncoder = new TextEncoder();
|
|
3107
3203
|
ifcLoader = null;
|
|
3108
3204
|
async ConvertIfcFileToBmt(e, t = {}) {
|
|
@@ -3169,7 +3265,7 @@ var Hi = "BMT", Ui = 1, J = {
|
|
|
3169
3265
|
}
|
|
3170
3266
|
createModelFiles(e, t, n) {
|
|
3171
3267
|
let r = n ? `${t}.min.bmt` : `${t}.bmt`, i = this.createBmtBytes(e, !n), a = [{
|
|
3172
|
-
blob: new Blob([i], { type:
|
|
3268
|
+
blob: new Blob([i], { type: ta }),
|
|
3173
3269
|
bytes: i,
|
|
3174
3270
|
name: r,
|
|
3175
3271
|
type: "bmt"
|
|
@@ -3180,7 +3276,7 @@ var Hi = "BMT", Ui = 1, J = {
|
|
|
3180
3276
|
structure: e.structure
|
|
3181
3277
|
});
|
|
3182
3278
|
a.push({
|
|
3183
|
-
blob: new Blob([n], { type:
|
|
3279
|
+
blob: new Blob([n], { type: ea }),
|
|
3184
3280
|
bytes: n,
|
|
3185
3281
|
name: `${t}_props.json`,
|
|
3186
3282
|
type: "json"
|
|
@@ -3189,8 +3285,8 @@ var Hi = "BMT", Ui = 1, J = {
|
|
|
3189
3285
|
return a;
|
|
3190
3286
|
}
|
|
3191
3287
|
createBmtBytes(e, t) {
|
|
3192
|
-
let n = new
|
|
3193
|
-
return n.writeBytes(this.textEncoder.encode(
|
|
3288
|
+
let n = new na();
|
|
3289
|
+
return n.writeBytes(this.textEncoder.encode(Qi)), n.writeUint8($i), t && this.writeProps(n, e.props), e.grids !== void 0 && this.writeJsonChunk(n, J.GRIDS, e.grids), this.writeMeshes(n, e), t && this.writeJsonChunk(n, J.STRUCTURE, e.structure), e.coordinationMatrix && !this.hasMeshMatrices(e) && this.writeTextChunk(n, J.MATRIX, e.coordinationMatrix), n.toUint8Array();
|
|
3194
3290
|
}
|
|
3195
3291
|
writeProps(e, t) {
|
|
3196
3292
|
Object.entries(t).forEach(([t, n]) => {
|
|
@@ -3208,7 +3304,7 @@ var Hi = "BMT", Ui = 1, J = {
|
|
|
3208
3304
|
});
|
|
3209
3305
|
}
|
|
3210
3306
|
createMeshPayload(e) {
|
|
3211
|
-
let t = new
|
|
3307
|
+
let t = new na(), n = this.deflateTypedArray(e.pos), r = this.deflateTypedArray(e.ids), i = this.deflateTypedArray(e.ind);
|
|
3212
3308
|
return t.writeUint32(n.byteLength), t.writeBytes(n), t.writeUint32(r.byteLength), t.writeBytes(r), t.writeUint32(i.byteLength), t.writeUint32(this.getIndexType(e.ind)), t.writeBytes(i), t.writeUint8(this.colorToByte(e.mat.r)), t.writeUint8(this.colorToByte(e.mat.g)), t.writeUint8(this.colorToByte(e.mat.b)), t.writeUint8(this.colorToByte(e.mat.opacity ?? 1)), t.writeUint32(e.mat.name), t.toUint8Array();
|
|
3213
3309
|
}
|
|
3214
3310
|
writeJsonChunk(e, t, n) {
|
|
@@ -3438,43 +3534,43 @@ var Hi = "BMT", Ui = 1, J = {
|
|
|
3438
3534
|
isRecord(e) {
|
|
3439
3535
|
return typeof e == "object" && !!e;
|
|
3440
3536
|
}
|
|
3441
|
-
},
|
|
3442
|
-
async function
|
|
3443
|
-
return
|
|
3537
|
+
}, ia = new ra();
|
|
3538
|
+
async function aa(e, t) {
|
|
3539
|
+
return ia.ConvertIfcFileToBmt(e, t);
|
|
3444
3540
|
}
|
|
3445
|
-
function
|
|
3446
|
-
return
|
|
3541
|
+
function oa(e, t) {
|
|
3542
|
+
return ia.ConvertToBmt(e, t);
|
|
3447
3543
|
}
|
|
3448
3544
|
//#endregion
|
|
3449
3545
|
//#region src/viewer/Selector/FilteredElementsCollector.ts
|
|
3450
3546
|
function Y(e) {
|
|
3451
3547
|
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
3452
3548
|
}
|
|
3453
|
-
function
|
|
3549
|
+
function sa(e) {
|
|
3454
3550
|
let t = Number(e);
|
|
3455
3551
|
return Number.isFinite(t) ? t : null;
|
|
3456
3552
|
}
|
|
3457
|
-
function
|
|
3553
|
+
function ca(e) {
|
|
3458
3554
|
return Y(e) && Y(e.data) && Y(e.props) && "structure" in e;
|
|
3459
3555
|
}
|
|
3460
|
-
function
|
|
3556
|
+
function la(e) {
|
|
3461
3557
|
return Y(e) && ("guid" in e || "id" in e || "props" in e || "sets" in e);
|
|
3462
3558
|
}
|
|
3463
|
-
function
|
|
3559
|
+
function ua(e) {
|
|
3464
3560
|
if (!Y(e)) return !1;
|
|
3465
3561
|
let t = Object.entries(e);
|
|
3466
|
-
return t.length ? t.every(([e, t]) =>
|
|
3562
|
+
return t.length ? t.every(([e, t]) => sa(e) !== null && la(t)) : !0;
|
|
3467
3563
|
}
|
|
3468
|
-
function
|
|
3564
|
+
function da(e) {
|
|
3469
3565
|
return typeof e == "string" ? e : null;
|
|
3470
3566
|
}
|
|
3471
|
-
function
|
|
3567
|
+
function fa(e) {
|
|
3472
3568
|
let t = Y(e.props.props) ? e.props.props : {};
|
|
3473
|
-
return
|
|
3569
|
+
return da(e.props.type ?? e.props.Type ?? t.type ?? t.Type);
|
|
3474
3570
|
}
|
|
3475
|
-
function
|
|
3571
|
+
function pa(e, t, n) {
|
|
3476
3572
|
Object.entries(n).forEach(([n, r]) => {
|
|
3477
|
-
let i =
|
|
3573
|
+
let i = sa(n);
|
|
3478
3574
|
i !== null && e.push({
|
|
3479
3575
|
elementID: i,
|
|
3480
3576
|
modelID: t,
|
|
@@ -3482,29 +3578,29 @@ function ra(e, t, n) {
|
|
|
3482
3578
|
});
|
|
3483
3579
|
});
|
|
3484
3580
|
}
|
|
3485
|
-
function
|
|
3581
|
+
function ma(e) {
|
|
3486
3582
|
if (!e || !Y(e)) return [];
|
|
3487
|
-
if (
|
|
3583
|
+
if (ca(e)) {
|
|
3488
3584
|
let t = [];
|
|
3489
|
-
return
|
|
3585
|
+
return pa(t, 0, e.props), t;
|
|
3490
3586
|
}
|
|
3491
|
-
if (
|
|
3587
|
+
if (ua(e)) {
|
|
3492
3588
|
let t = [];
|
|
3493
|
-
return
|
|
3589
|
+
return pa(t, 0, e), t;
|
|
3494
3590
|
}
|
|
3495
3591
|
let t = [];
|
|
3496
3592
|
return Object.entries(e).forEach(([e, n]) => {
|
|
3497
|
-
let r =
|
|
3593
|
+
let r = sa(e);
|
|
3498
3594
|
if (r !== null) {
|
|
3499
|
-
if (
|
|
3500
|
-
|
|
3595
|
+
if (ca(n)) {
|
|
3596
|
+
pa(t, r, n.props);
|
|
3501
3597
|
return;
|
|
3502
3598
|
}
|
|
3503
|
-
|
|
3599
|
+
ua(n) && pa(t, r, n);
|
|
3504
3600
|
}
|
|
3505
3601
|
}), t;
|
|
3506
3602
|
}
|
|
3507
|
-
function
|
|
3603
|
+
function ha(e) {
|
|
3508
3604
|
let t = {};
|
|
3509
3605
|
return e.forEach(({ elementID: e, modelID: n, props: r }) => {
|
|
3510
3606
|
t[n] ??= [], t[n].push({
|
|
@@ -3513,26 +3609,26 @@ function aa(e) {
|
|
|
3513
3609
|
});
|
|
3514
3610
|
}), t;
|
|
3515
3611
|
}
|
|
3516
|
-
function
|
|
3612
|
+
function ga(e) {
|
|
3517
3613
|
let t = {};
|
|
3518
3614
|
return e.forEach(({ elementID: e, modelID: n }) => {
|
|
3519
3615
|
t[n] ??= [], t[n].push(e);
|
|
3520
3616
|
}), t;
|
|
3521
3617
|
}
|
|
3522
|
-
var
|
|
3618
|
+
var _a = class {
|
|
3523
3619
|
elements;
|
|
3524
3620
|
filters = [];
|
|
3525
3621
|
selectedModelIDs = null;
|
|
3526
3622
|
constructor(e) {
|
|
3527
|
-
this.elements =
|
|
3623
|
+
this.elements = ma(e);
|
|
3528
3624
|
}
|
|
3529
3625
|
from(e) {
|
|
3530
|
-
return this.elements =
|
|
3626
|
+
return this.elements = ma(e), this.filters = [], this.selectedModelIDs = null, this;
|
|
3531
3627
|
}
|
|
3532
3628
|
ofType(e) {
|
|
3533
3629
|
let t = new Set((Array.isArray(e) ? e : [e]).map((e) => e.toLowerCase()));
|
|
3534
3630
|
return this.filters.push((e) => {
|
|
3535
|
-
let n =
|
|
3631
|
+
let n = fa(e);
|
|
3536
3632
|
return !!(n && t.has(n.toLowerCase()));
|
|
3537
3633
|
}), this;
|
|
3538
3634
|
}
|
|
@@ -3561,11 +3657,11 @@ var sa = class {
|
|
|
3561
3657
|
return this.hasSingleSelectedModel() ? e.map(({ elementID: e, props: t }) => ({
|
|
3562
3658
|
elementID: e,
|
|
3563
3659
|
props: t
|
|
3564
|
-
})) :
|
|
3660
|
+
})) : ha(e);
|
|
3565
3661
|
}
|
|
3566
3662
|
toElementsIds() {
|
|
3567
3663
|
let e = this.getFilteredElements();
|
|
3568
|
-
return this.hasSingleSelectedModel() ? e.map(({ elementID: e }) => e) :
|
|
3664
|
+
return this.hasSingleSelectedModel() ? e.map(({ elementID: e }) => e) : ga(e);
|
|
3569
3665
|
}
|
|
3570
3666
|
toElementIds() {
|
|
3571
3667
|
return this.toElementsIds();
|
|
@@ -3573,20 +3669,20 @@ var sa = class {
|
|
|
3573
3669
|
};
|
|
3574
3670
|
//#endregion
|
|
3575
3671
|
//#region src/viewer/api/ViewerApi.ts
|
|
3576
|
-
function
|
|
3672
|
+
function va(e) {
|
|
3577
3673
|
let t = {};
|
|
3578
3674
|
return Object.entries(e).forEach(([e, n]) => {
|
|
3579
3675
|
t[Number(e)] = Array.from(n);
|
|
3580
3676
|
}), t;
|
|
3581
3677
|
}
|
|
3582
|
-
function
|
|
3678
|
+
function ya(e) {
|
|
3583
3679
|
let t = {};
|
|
3584
3680
|
return Object.entries(e).forEach(([e, n]) => {
|
|
3585
3681
|
t[Number(e)] = new Set(n);
|
|
3586
3682
|
}), t;
|
|
3587
3683
|
}
|
|
3588
|
-
function
|
|
3589
|
-
let n = new
|
|
3684
|
+
function ba(e, t) {
|
|
3685
|
+
let n = new ra();
|
|
3590
3686
|
return {
|
|
3591
3687
|
camera: {
|
|
3592
3688
|
fitCamera: () => {
|
|
@@ -3636,6 +3732,12 @@ function ua(e, t) {
|
|
|
3636
3732
|
clearModelColors: (e) => {
|
|
3637
3733
|
t()?.colors.clearModelColors(e);
|
|
3638
3734
|
},
|
|
3735
|
+
rebuildByColors: (e, n) => {
|
|
3736
|
+
t()?.colors.rebuildByColors(e, n);
|
|
3737
|
+
},
|
|
3738
|
+
rebuildModelByColors: (e, n, r) => {
|
|
3739
|
+
t()?.colors.rebuildModelByColors(e, n, r);
|
|
3740
|
+
},
|
|
3639
3741
|
setColor: (e, n, r) => {
|
|
3640
3742
|
t()?.colors.setColor(e, n, r);
|
|
3641
3743
|
}
|
|
@@ -3720,16 +3822,16 @@ function ua(e, t) {
|
|
|
3720
3822
|
t()?.geometryUtils.toggleIIfcSpacesVisibility();
|
|
3721
3823
|
}
|
|
3722
3824
|
},
|
|
3723
|
-
properties:
|
|
3825
|
+
properties: Zi(e),
|
|
3724
3826
|
selector: {
|
|
3725
3827
|
addSelected: (n, r, i = !0, a = !1) => {
|
|
3726
3828
|
let o = i || a;
|
|
3727
|
-
e.getState().addSelected(n, r), o && t()?.selector.setTargetToSelection(
|
|
3829
|
+
e.getState().addSelected(n, r), o && t()?.selector.setTargetToSelection(va(e.getState().selected), a);
|
|
3728
3830
|
},
|
|
3729
|
-
collector: () => new
|
|
3831
|
+
collector: () => new _a(e.getState().modelProps),
|
|
3730
3832
|
getPreselectionColor: () => e.getState().preselectionColor,
|
|
3731
3833
|
getSelectionColor: () => e.getState().selectionColor,
|
|
3732
|
-
getSelected: () =>
|
|
3834
|
+
getSelected: () => va(e.getState().selected),
|
|
3733
3835
|
removeSelected: (t, n) => {
|
|
3734
3836
|
e.getState().removeSelected(t, n);
|
|
3735
3837
|
},
|
|
@@ -3744,7 +3846,7 @@ function ua(e, t) {
|
|
|
3744
3846
|
},
|
|
3745
3847
|
setSelected: (n, r, i = !1, a = !0, o = !1) => {
|
|
3746
3848
|
let s = a || o;
|
|
3747
|
-
e.getState().setSelected(n, r, i), s && t()?.selector.setTargetToSelection(
|
|
3849
|
+
e.getState().setSelected(n, r, i), s && t()?.selector.setTargetToSelection(va(e.getState().selected), o);
|
|
3748
3850
|
}
|
|
3749
3851
|
},
|
|
3750
3852
|
utils: {
|
|
@@ -3789,7 +3891,7 @@ function ua(e, t) {
|
|
|
3789
3891
|
}
|
|
3790
3892
|
//#endregion
|
|
3791
3893
|
//#region src/viewer/Loaders/BmtLoader.ts
|
|
3792
|
-
var
|
|
3894
|
+
var xa = class {
|
|
3793
3895
|
view;
|
|
3794
3896
|
offset = 0;
|
|
3795
3897
|
constructor(e) {
|
|
@@ -3809,7 +3911,7 @@ var da = class {
|
|
|
3809
3911
|
eof() {
|
|
3810
3912
|
return this.offset >= this.view.byteLength;
|
|
3811
3913
|
}
|
|
3812
|
-
},
|
|
3914
|
+
}, Sa = class {
|
|
3813
3915
|
decodeBuffer(e) {
|
|
3814
3916
|
return this.textDecoder.decode(we.inflate(e));
|
|
3815
3917
|
}
|
|
@@ -3882,7 +3984,7 @@ var da = class {
|
|
|
3882
3984
|
return a?.props && (i.props = a.props), a?.grids && (i.grids = a.grids), a?.coordinationMatrix && (i.coordinationMatrix = a.coordinationMatrix), a?.structure !== void 0 && (i.structure = a.structure), i;
|
|
3883
3985
|
}
|
|
3884
3986
|
parseBinaryFile(e, t = {}) {
|
|
3885
|
-
let n = new
|
|
3987
|
+
let n = new xa(e);
|
|
3886
3988
|
if (new TextDecoder().decode(n.readBytes(3)) !== "BMT") throw Error("Invalid file");
|
|
3887
3989
|
let r = n.readUint8();
|
|
3888
3990
|
console.log(`model version: ${r}`);
|
|
@@ -3950,24 +4052,24 @@ var da = class {
|
|
|
3950
4052
|
};
|
|
3951
4053
|
//#endregion
|
|
3952
4054
|
//#region src/viewer/workers/BMTWorker.ts?worker
|
|
3953
|
-
function
|
|
4055
|
+
function Ca(e) {
|
|
3954
4056
|
return new Worker("" + new URL("assets/BMTWorker-yhSXOg2i.js", import.meta.url).href, { name: e?.name });
|
|
3955
4057
|
}
|
|
3956
4058
|
//#endregion
|
|
3957
4059
|
//#region src/viewer/workers/BMTWorkerClient.ts
|
|
3958
|
-
function
|
|
4060
|
+
function wa() {
|
|
3959
4061
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
|
|
3960
4062
|
}
|
|
3961
|
-
function
|
|
4063
|
+
function Ta(e) {
|
|
3962
4064
|
return Array.isArray(e) ? e : [e];
|
|
3963
4065
|
}
|
|
3964
|
-
function
|
|
4066
|
+
function Ea(e) {
|
|
3965
4067
|
return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.bmt";
|
|
3966
4068
|
}
|
|
3967
|
-
function
|
|
4069
|
+
function Da(e) {
|
|
3968
4070
|
return typeof e == "string" ? {
|
|
3969
4071
|
kind: "url",
|
|
3970
|
-
name:
|
|
4072
|
+
name: Ea(e),
|
|
3971
4073
|
url: new URL(e, globalThis.location.href).href
|
|
3972
4074
|
} : e instanceof File ? {
|
|
3973
4075
|
file: e,
|
|
@@ -3978,18 +4080,18 @@ function _a(e) {
|
|
|
3978
4080
|
kind: "buffer"
|
|
3979
4081
|
};
|
|
3980
4082
|
}
|
|
3981
|
-
function
|
|
4083
|
+
function Oa(e) {
|
|
3982
4084
|
return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
|
|
3983
4085
|
}
|
|
3984
|
-
function
|
|
3985
|
-
return new
|
|
4086
|
+
function ka() {
|
|
4087
|
+
return new Ca();
|
|
3986
4088
|
}
|
|
3987
|
-
function
|
|
4089
|
+
function Aa(e) {
|
|
3988
4090
|
return { streamGeometryChunks: e.streamGeometryChunks ?? !!e.onChunk };
|
|
3989
4091
|
}
|
|
3990
|
-
function
|
|
3991
|
-
let n = t.worker ??
|
|
3992
|
-
options:
|
|
4092
|
+
function ja(e, t = {}) {
|
|
4093
|
+
let n = t.worker ?? ka(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Ta(e).map(Da), o = wa(), s = {}, c = {
|
|
4094
|
+
options: Aa(t),
|
|
3993
4095
|
sources: a,
|
|
3994
4096
|
taskId: o,
|
|
3995
4097
|
type: "load-bmt-model"
|
|
@@ -4027,39 +4129,39 @@ function xa(e, t = {}) {
|
|
|
4027
4129
|
let a = Error(r.error.message);
|
|
4028
4130
|
r.error.stack && (a.stack = r.error.stack), l(a);
|
|
4029
4131
|
};
|
|
4030
|
-
n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c,
|
|
4132
|
+
n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, Oa(a));
|
|
4031
4133
|
});
|
|
4032
4134
|
}
|
|
4033
|
-
function
|
|
4034
|
-
return
|
|
4135
|
+
function Ma() {
|
|
4136
|
+
return ka();
|
|
4035
4137
|
}
|
|
4036
4138
|
//#endregion
|
|
4037
4139
|
//#region src/viewer/workers/BmtConverterWorker.ts?worker
|
|
4038
|
-
function
|
|
4140
|
+
function Na(e) {
|
|
4039
4141
|
return new Worker("" + new URL("assets/BmtConverterWorker-D4BQ-hoH.js", import.meta.url).href, { name: e?.name });
|
|
4040
4142
|
}
|
|
4041
4143
|
//#endregion
|
|
4042
4144
|
//#region src/viewer/workers/BmtConverterWorkerClient.ts
|
|
4043
|
-
function
|
|
4145
|
+
function Pa() {
|
|
4044
4146
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
|
|
4045
4147
|
}
|
|
4046
|
-
function
|
|
4148
|
+
function Fa(e) {
|
|
4047
4149
|
return Array.isArray(e) ? e : [e];
|
|
4048
4150
|
}
|
|
4049
|
-
function
|
|
4151
|
+
function Ia(e) {
|
|
4050
4152
|
return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
|
|
4051
4153
|
}
|
|
4052
|
-
function
|
|
4154
|
+
function La() {
|
|
4053
4155
|
return globalThis.document?.baseURI ?? globalThis.location.href;
|
|
4054
4156
|
}
|
|
4055
|
-
function
|
|
4157
|
+
function Ra(e) {
|
|
4056
4158
|
let t = e ?? "ifc-parser.wasm";
|
|
4057
|
-
return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t,
|
|
4159
|
+
return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, La()).href;
|
|
4058
4160
|
}
|
|
4059
|
-
function
|
|
4161
|
+
function za(e) {
|
|
4060
4162
|
return typeof e == "string" ? {
|
|
4061
4163
|
kind: "url",
|
|
4062
|
-
name:
|
|
4164
|
+
name: Ia(e),
|
|
4063
4165
|
url: new URL(e, globalThis.location.href).href
|
|
4064
4166
|
} : e instanceof File ? {
|
|
4065
4167
|
file: e,
|
|
@@ -4070,13 +4172,13 @@ function ka(e) {
|
|
|
4070
4172
|
kind: "buffer"
|
|
4071
4173
|
};
|
|
4072
4174
|
}
|
|
4073
|
-
function
|
|
4175
|
+
function Ba(e) {
|
|
4074
4176
|
return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
|
|
4075
4177
|
}
|
|
4076
|
-
function
|
|
4077
|
-
return new
|
|
4178
|
+
function Va() {
|
|
4179
|
+
return new Na();
|
|
4078
4180
|
}
|
|
4079
|
-
function
|
|
4181
|
+
function Ha(e) {
|
|
4080
4182
|
return {
|
|
4081
4183
|
chunk: e.chunk,
|
|
4082
4184
|
coordinationMatrix: e.coordinationMatrix,
|
|
@@ -4088,23 +4190,23 @@ function Ma(e) {
|
|
|
4088
4190
|
useIfcSpace: e.useIfcSpace,
|
|
4089
4191
|
useMinVersion: e.useMinVersion,
|
|
4090
4192
|
visibleIdsByModel: e.visibleIdsByModel,
|
|
4091
|
-
wasmPath:
|
|
4193
|
+
wasmPath: Ra(e.wasmPath)
|
|
4092
4194
|
};
|
|
4093
4195
|
}
|
|
4094
|
-
function
|
|
4196
|
+
function Ua(e) {
|
|
4095
4197
|
let t = new Uint8Array(e.bytes.byteLength);
|
|
4096
4198
|
return t.set(e.bytes), {
|
|
4097
4199
|
...e,
|
|
4098
4200
|
blob: new Blob([t.buffer], { type: e.mimeType })
|
|
4099
4201
|
};
|
|
4100
4202
|
}
|
|
4101
|
-
function
|
|
4203
|
+
function Wa(e) {
|
|
4102
4204
|
return {
|
|
4103
|
-
files: e.result.files.map(
|
|
4205
|
+
files: e.result.files.map(Ua),
|
|
4104
4206
|
models: e.result.models
|
|
4105
4207
|
};
|
|
4106
4208
|
}
|
|
4107
|
-
function
|
|
4209
|
+
function Ga(e) {
|
|
4108
4210
|
if (e.error instanceof Error) return e.error;
|
|
4109
4211
|
let t = [
|
|
4110
4212
|
e.message || "Unknown worker error",
|
|
@@ -4114,12 +4216,12 @@ function Fa(e) {
|
|
|
4114
4216
|
].filter(Boolean);
|
|
4115
4217
|
return /* @__PURE__ */ Error(`BMT converter worker failed: ${t.join(", ")}`);
|
|
4116
4218
|
}
|
|
4117
|
-
function
|
|
4219
|
+
function Ka(e) {
|
|
4118
4220
|
return /* @__PURE__ */ Error(`BMT converter worker response could not be cloned: ${String(e.data ?? "unknown message error")}`);
|
|
4119
4221
|
}
|
|
4120
|
-
function
|
|
4121
|
-
let n = t.worker ??
|
|
4122
|
-
options:
|
|
4222
|
+
function qa(e, t = {}) {
|
|
4223
|
+
let n = t.worker ?? Va(), r = t.terminateOnComplete ?? !t.worker, i = Fa(e).map(za), a = Pa(), o = {
|
|
4224
|
+
options: Ha(t),
|
|
4123
4225
|
sources: i,
|
|
4124
4226
|
taskId: a,
|
|
4125
4227
|
type: "convert-ifc-to-bmt"
|
|
@@ -4128,9 +4230,9 @@ function La(e, t = {}) {
|
|
|
4128
4230
|
let c = () => {
|
|
4129
4231
|
n.removeEventListener("message", d), n.removeEventListener("error", l), n.removeEventListener("messageerror", u), r && n.terminate();
|
|
4130
4232
|
}, l = (e) => {
|
|
4131
|
-
c(), s(
|
|
4233
|
+
c(), s(Ga(e));
|
|
4132
4234
|
}, u = (e) => {
|
|
4133
|
-
c(), s(
|
|
4235
|
+
c(), s(Ka(e));
|
|
4134
4236
|
}, d = (n) => {
|
|
4135
4237
|
let r = n.data;
|
|
4136
4238
|
if (r.taskId !== a) return;
|
|
@@ -4139,35 +4241,35 @@ function La(e, t = {}) {
|
|
|
4139
4241
|
return;
|
|
4140
4242
|
}
|
|
4141
4243
|
if (c(), r.type === "complete") {
|
|
4142
|
-
e(
|
|
4244
|
+
e(Wa(r));
|
|
4143
4245
|
return;
|
|
4144
4246
|
}
|
|
4145
4247
|
let i = Error(r.error.message);
|
|
4146
4248
|
r.error.stack && (i.stack = r.error.stack), s(i);
|
|
4147
4249
|
};
|
|
4148
|
-
n.addEventListener("message", d), n.addEventListener("error", l), n.addEventListener("messageerror", u), n.postMessage(o,
|
|
4250
|
+
n.addEventListener("message", d), n.addEventListener("error", l), n.addEventListener("messageerror", u), n.postMessage(o, Ba(i));
|
|
4149
4251
|
});
|
|
4150
4252
|
}
|
|
4151
|
-
function
|
|
4152
|
-
return
|
|
4253
|
+
function Ja() {
|
|
4254
|
+
return Va();
|
|
4153
4255
|
}
|
|
4154
4256
|
//#endregion
|
|
4155
4257
|
//#region src/viewer/workers/IFCWorker.ts?worker
|
|
4156
|
-
function
|
|
4258
|
+
function Ya(e) {
|
|
4157
4259
|
return new Worker("" + new URL("assets/IFCWorker-Dgk5iwps.js", import.meta.url).href, { name: e?.name });
|
|
4158
4260
|
}
|
|
4159
4261
|
//#endregion
|
|
4160
4262
|
//#region src/viewer/workers/IFCWorkerClient.ts
|
|
4161
|
-
function
|
|
4263
|
+
function Xa() {
|
|
4162
4264
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
|
|
4163
4265
|
}
|
|
4164
|
-
function
|
|
4266
|
+
function Za(e) {
|
|
4165
4267
|
return Array.isArray(e) ? e : [e];
|
|
4166
4268
|
}
|
|
4167
|
-
function
|
|
4269
|
+
function Qa(e) {
|
|
4168
4270
|
return typeof e == "string" ? {
|
|
4169
4271
|
kind: "url",
|
|
4170
|
-
name:
|
|
4272
|
+
name: $a(e),
|
|
4171
4273
|
url: new URL(e, globalThis.location.href).href
|
|
4172
4274
|
} : e instanceof File ? {
|
|
4173
4275
|
file: e,
|
|
@@ -4178,23 +4280,23 @@ function Ha(e) {
|
|
|
4178
4280
|
kind: "buffer"
|
|
4179
4281
|
};
|
|
4180
4282
|
}
|
|
4181
|
-
function
|
|
4283
|
+
function $a(e) {
|
|
4182
4284
|
return e.split(/[?#]/)[0].split(/[\\/]/).pop() || "model.ifc";
|
|
4183
4285
|
}
|
|
4184
|
-
function
|
|
4286
|
+
function eo() {
|
|
4185
4287
|
return globalThis.document?.baseURI ?? globalThis.location.href;
|
|
4186
4288
|
}
|
|
4187
|
-
function
|
|
4289
|
+
function to(e) {
|
|
4188
4290
|
let t = e ?? "ifc-parser.wasm";
|
|
4189
|
-
return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t,
|
|
4291
|
+
return /^(https?:|blob:|data:)/i.test(t) ? t : new URL(t, eo()).href;
|
|
4190
4292
|
}
|
|
4191
|
-
function
|
|
4293
|
+
function no(e) {
|
|
4192
4294
|
return e.map((e) => e.kind === "buffer" ? e.buffer : null).filter((e) => e instanceof ArrayBuffer);
|
|
4193
4295
|
}
|
|
4194
|
-
function
|
|
4195
|
-
return new
|
|
4296
|
+
function ro() {
|
|
4297
|
+
return new Ya();
|
|
4196
4298
|
}
|
|
4197
|
-
function
|
|
4299
|
+
function io(e) {
|
|
4198
4300
|
return {
|
|
4199
4301
|
chunk: e.chunk,
|
|
4200
4302
|
coordinationMatrix: e.coordinationMatrix,
|
|
@@ -4203,12 +4305,12 @@ function Ja(e) {
|
|
|
4203
4305
|
useIfcColors: e.useIfcColors,
|
|
4204
4306
|
useIfcElementAssembly: e.useIfcElementAssembly,
|
|
4205
4307
|
useIfcSpace: e.useIfcSpace,
|
|
4206
|
-
wasmPath:
|
|
4308
|
+
wasmPath: to(e.wasmPath)
|
|
4207
4309
|
};
|
|
4208
4310
|
}
|
|
4209
|
-
function
|
|
4210
|
-
let n = t.worker ??
|
|
4211
|
-
options:
|
|
4311
|
+
function ao(e, t = {}) {
|
|
4312
|
+
let n = t.worker ?? ro(), r = t.terminateOnComplete ?? !t.worker, i = t.collectChunks ?? !0, a = Za(e).map(Qa), o = Xa(), s = {}, c = {
|
|
4313
|
+
options: io(t),
|
|
4212
4314
|
sources: a,
|
|
4213
4315
|
taskId: o,
|
|
4214
4316
|
type: "load-ifc-model"
|
|
@@ -4246,34 +4348,34 @@ function Ya(e, t = {}) {
|
|
|
4246
4348
|
let a = Error(r.error.message);
|
|
4247
4349
|
r.error.stack && (a.stack = r.error.stack), l(a);
|
|
4248
4350
|
};
|
|
4249
|
-
n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c,
|
|
4351
|
+
n.addEventListener("message", f), n.addEventListener("error", d), n.postMessage(c, no(a));
|
|
4250
4352
|
});
|
|
4251
4353
|
}
|
|
4252
|
-
function
|
|
4253
|
-
return
|
|
4354
|
+
function oo() {
|
|
4355
|
+
return ro();
|
|
4254
4356
|
}
|
|
4255
4357
|
//#endregion
|
|
4256
4358
|
//#region src/viewer/api/loader.ts
|
|
4257
|
-
function
|
|
4359
|
+
function so(e) {
|
|
4258
4360
|
return typeof e == "string" ? e : e.name;
|
|
4259
4361
|
}
|
|
4260
|
-
function
|
|
4261
|
-
return (
|
|
4362
|
+
function co(e) {
|
|
4363
|
+
return (so(e).split(/[?#]/)[0].split(/[\\/]/).pop() || "model").replace(/\.min\.bmt$/i, "").replace(/\.[^.]+$/i, "") || "model";
|
|
4262
4364
|
}
|
|
4263
|
-
function
|
|
4264
|
-
let t =
|
|
4365
|
+
function lo(e) {
|
|
4366
|
+
let t = so(e).split(/[?#]/)[0].toLowerCase(), n = t.lastIndexOf(".");
|
|
4265
4367
|
return n === -1 ? "" : t.slice(n + 1);
|
|
4266
4368
|
}
|
|
4267
|
-
function
|
|
4369
|
+
function uo(e) {
|
|
4268
4370
|
return /\.min\.bmt$/i.test(e.name) ? e.name.replace(/\.min\.bmt$/i, "_props.json") : null;
|
|
4269
4371
|
}
|
|
4270
|
-
function
|
|
4271
|
-
return /_props\.json$/i.test(
|
|
4372
|
+
function fo(e) {
|
|
4373
|
+
return /_props\.json$/i.test(so(e).split(/[?#]/)[0]);
|
|
4272
4374
|
}
|
|
4273
|
-
function
|
|
4375
|
+
function po(e) {
|
|
4274
4376
|
return e.coordinationMatrix ? e.coordinationMatrix : Object.values(e.data)[0]?.matrix || void 0;
|
|
4275
4377
|
}
|
|
4276
|
-
var
|
|
4378
|
+
var mo = new class {
|
|
4277
4379
|
coordinationMatrix;
|
|
4278
4380
|
useIfcSpace = !1;
|
|
4279
4381
|
bmtLoader = null;
|
|
@@ -4284,7 +4386,7 @@ var ro = new class {
|
|
|
4284
4386
|
this.getBmtLoader();
|
|
4285
4387
|
}
|
|
4286
4388
|
getBmtLoader() {
|
|
4287
|
-
return this.bmtLoader ||= new
|
|
4389
|
+
return this.bmtLoader ||= new Sa(), this.bmtLoader;
|
|
4288
4390
|
}
|
|
4289
4391
|
async getIfcLoader(e = {}) {
|
|
4290
4392
|
if (!this.ifcLoader) {
|
|
@@ -4312,7 +4414,7 @@ var ro = new class {
|
|
|
4312
4414
|
async loadBmtModel(e, t) {
|
|
4313
4415
|
let n = this.getBmtLoader();
|
|
4314
4416
|
if (typeof e == "string") return n.loadModel(e);
|
|
4315
|
-
let r = n.parseBinaryFile(await e.arrayBuffer()), i =
|
|
4417
|
+
let r = n.parseBinaryFile(await e.arrayBuffer()), i = uo(e), a = i ? t.get(i) : void 0;
|
|
4316
4418
|
return this.applyBmtMetadata(r, a);
|
|
4317
4419
|
}
|
|
4318
4420
|
createWorkerProgressHandler(e, t, n, r) {
|
|
@@ -4335,7 +4437,7 @@ var ro = new class {
|
|
|
4335
4437
|
};
|
|
4336
4438
|
}
|
|
4337
4439
|
async loadIfcModelInWorker(e, t, n, r, i) {
|
|
4338
|
-
return (await
|
|
4440
|
+
return (await ao(e, {
|
|
4339
4441
|
chunk: t.chunk,
|
|
4340
4442
|
collectChunks: t.collectWorkerChunks,
|
|
4341
4443
|
coordinationMatrix: this.coordinationMatrix,
|
|
@@ -4348,14 +4450,14 @@ var ro = new class {
|
|
|
4348
4450
|
}))[0];
|
|
4349
4451
|
}
|
|
4350
4452
|
async loadBmtModelInWorker(e, t, n, r, i, a) {
|
|
4351
|
-
let o = (await
|
|
4453
|
+
let o = (await ja(e, {
|
|
4352
4454
|
collectChunks: n.collectWorkerChunks,
|
|
4353
4455
|
onChunk: this.createWorkerChunkHandler(n, r),
|
|
4354
4456
|
onProgress: this.createWorkerProgressHandler(n, r, i, a),
|
|
4355
4457
|
streamGeometryChunks: n.streamGeometryChunks ?? !!n.onChunk
|
|
4356
4458
|
}))[0];
|
|
4357
4459
|
if (e instanceof File) {
|
|
4358
|
-
let n =
|
|
4460
|
+
let n = uo(e), r = n ? t.get(n) : void 0;
|
|
4359
4461
|
return this.applyBmtMetadata(o, r);
|
|
4360
4462
|
}
|
|
4361
4463
|
return o;
|
|
@@ -4368,21 +4470,21 @@ var ro = new class {
|
|
|
4368
4470
|
}
|
|
4369
4471
|
async loadModel(e, t = {}) {
|
|
4370
4472
|
this.initLoaders();
|
|
4371
|
-
let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !
|
|
4473
|
+
let n = Array.isArray(e) ? e : [e], r = this.getFileSourceMap(n), i = {}, a = n.filter((e) => !fo(e)).length, o = 0;
|
|
4372
4474
|
this.loadedModelCount === 0 && this.resetCoordinationMatrixState();
|
|
4373
4475
|
for (let e = 0; e < n.length; e++) {
|
|
4374
|
-
let s = n[e], c =
|
|
4375
|
-
if (c === "json" &&
|
|
4476
|
+
let s = n[e], c = lo(s), l;
|
|
4477
|
+
if (c === "json" && fo(s)) continue;
|
|
4376
4478
|
let u = this.nextModelID, d = o;
|
|
4377
4479
|
if (o++, c === "ifc") l = t.useWorker ? await this.loadIfcModelInWorker(s, t, u, d, a) : (await (await this.getIfcLoader(t)).loadModel(s, this.coordinationMatrix))[0];
|
|
4378
4480
|
else if (c === "bmt") l = t.useWorker ? await this.loadBmtModelInWorker(s, r, t, u, d, a) : await this.loadBmtModel(s, r);
|
|
4379
|
-
else throw Error(`Unsupported model format: ${
|
|
4380
|
-
let f =
|
|
4381
|
-
!this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), l.name ??=
|
|
4481
|
+
else throw Error(`Unsupported model format: ${so(s)}`);
|
|
4482
|
+
let f = po(l);
|
|
4483
|
+
!this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), l.name ??= co(s), this.nextModelID += 1, this.loadedModelCount += 1, i[u] = l;
|
|
4382
4484
|
}
|
|
4383
4485
|
return i;
|
|
4384
4486
|
}
|
|
4385
|
-
}(),
|
|
4487
|
+
}(), ho = .5, X = .04, Z = .16, go = Z, Q = ho * 2 - Z * 2, _o = ho - X / 2, vo = ho - Z / 2, yo = ho - go / 2, bo = .63, xo = "#dfe6ec", So = 260, Co = 52, wo = .17, To = new g(), $ = new de(), Eo = [
|
|
4386
4488
|
{
|
|
4387
4489
|
direction: [
|
|
4388
4490
|
0,
|
|
@@ -4393,7 +4495,7 @@ var ro = new class {
|
|
|
4393
4495
|
position: [
|
|
4394
4496
|
0,
|
|
4395
4497
|
0,
|
|
4396
|
-
|
|
4498
|
+
_o
|
|
4397
4499
|
],
|
|
4398
4500
|
scale: [
|
|
4399
4501
|
Q,
|
|
@@ -4413,7 +4515,7 @@ var ro = new class {
|
|
|
4413
4515
|
position: [
|
|
4414
4516
|
0,
|
|
4415
4517
|
0,
|
|
4416
|
-
-
|
|
4518
|
+
-_o
|
|
4417
4519
|
],
|
|
4418
4520
|
rotation: [
|
|
4419
4521
|
0,
|
|
@@ -4436,7 +4538,7 @@ var ro = new class {
|
|
|
4436
4538
|
],
|
|
4437
4539
|
label: "right",
|
|
4438
4540
|
position: [
|
|
4439
|
-
|
|
4541
|
+
_o,
|
|
4440
4542
|
0,
|
|
4441
4543
|
0
|
|
4442
4544
|
],
|
|
@@ -4461,7 +4563,7 @@ var ro = new class {
|
|
|
4461
4563
|
],
|
|
4462
4564
|
label: "left",
|
|
4463
4565
|
position: [
|
|
4464
|
-
-
|
|
4566
|
+
-_o,
|
|
4465
4567
|
0,
|
|
4466
4568
|
0
|
|
4467
4569
|
],
|
|
@@ -4487,7 +4589,7 @@ var ro = new class {
|
|
|
4487
4589
|
label: "top",
|
|
4488
4590
|
position: [
|
|
4489
4591
|
0,
|
|
4490
|
-
|
|
4592
|
+
_o,
|
|
4491
4593
|
0
|
|
4492
4594
|
],
|
|
4493
4595
|
rotation: [
|
|
@@ -4512,7 +4614,7 @@ var ro = new class {
|
|
|
4512
4614
|
label: "bot",
|
|
4513
4615
|
position: [
|
|
4514
4616
|
0,
|
|
4515
|
-
-
|
|
4617
|
+
-_o,
|
|
4516
4618
|
0
|
|
4517
4619
|
],
|
|
4518
4620
|
rotation: [
|
|
@@ -4529,7 +4631,7 @@ var ro = new class {
|
|
|
4529
4631
|
type: "face"
|
|
4530
4632
|
}
|
|
4531
4633
|
];
|
|
4532
|
-
function
|
|
4634
|
+
function Do() {
|
|
4533
4635
|
let e = [], t = [-1, 1];
|
|
4534
4636
|
return t.forEach((n) => {
|
|
4535
4637
|
t.forEach((t) => {
|
|
@@ -4541,8 +4643,8 @@ function _o() {
|
|
|
4541
4643
|
],
|
|
4542
4644
|
position: [
|
|
4543
4645
|
0,
|
|
4544
|
-
n *
|
|
4545
|
-
t *
|
|
4646
|
+
n * vo,
|
|
4647
|
+
t * vo
|
|
4546
4648
|
],
|
|
4547
4649
|
scale: [
|
|
4548
4650
|
Q,
|
|
@@ -4562,9 +4664,9 @@ function _o() {
|
|
|
4562
4664
|
t
|
|
4563
4665
|
],
|
|
4564
4666
|
position: [
|
|
4565
|
-
n *
|
|
4667
|
+
n * vo,
|
|
4566
4668
|
0,
|
|
4567
|
-
t *
|
|
4669
|
+
t * vo
|
|
4568
4670
|
],
|
|
4569
4671
|
scale: [
|
|
4570
4672
|
Z,
|
|
@@ -4584,8 +4686,8 @@ function _o() {
|
|
|
4584
4686
|
0
|
|
4585
4687
|
],
|
|
4586
4688
|
position: [
|
|
4587
|
-
n *
|
|
4588
|
-
t *
|
|
4689
|
+
n * vo,
|
|
4690
|
+
t * vo,
|
|
4589
4691
|
0
|
|
4590
4692
|
],
|
|
4591
4693
|
scale: [
|
|
@@ -4599,7 +4701,7 @@ function _o() {
|
|
|
4599
4701
|
});
|
|
4600
4702
|
}), e;
|
|
4601
4703
|
}
|
|
4602
|
-
function
|
|
4704
|
+
function Oo() {
|
|
4603
4705
|
let e = [], t = [-1, 1];
|
|
4604
4706
|
return t.forEach((n) => {
|
|
4605
4707
|
t.forEach((r) => {
|
|
@@ -4611,14 +4713,14 @@ function vo() {
|
|
|
4611
4713
|
t
|
|
4612
4714
|
],
|
|
4613
4715
|
position: [
|
|
4614
|
-
n *
|
|
4615
|
-
r *
|
|
4616
|
-
t *
|
|
4716
|
+
n * yo,
|
|
4717
|
+
r * yo,
|
|
4718
|
+
t * yo
|
|
4617
4719
|
],
|
|
4618
4720
|
scale: [
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4721
|
+
go,
|
|
4722
|
+
go,
|
|
4723
|
+
go
|
|
4622
4724
|
],
|
|
4623
4725
|
title: `${r > 0 ? "Top" : "Bottom"} ${n > 0 ? "Right" : "Left"} ${t > 0 ? "Front" : "Back"}`,
|
|
4624
4726
|
type: "corner"
|
|
@@ -4627,21 +4729,21 @@ function vo() {
|
|
|
4627
4729
|
});
|
|
4628
4730
|
}), e;
|
|
4629
4731
|
}
|
|
4630
|
-
function
|
|
4732
|
+
function ko(e) {
|
|
4631
4733
|
e.stopPropagation(), e.nativeEvent.stopPropagation(), e.nativeEvent.stopImmediatePropagation?.();
|
|
4632
4734
|
}
|
|
4633
|
-
function
|
|
4634
|
-
return e ? "#4f7fa3" :
|
|
4735
|
+
function Ao(e) {
|
|
4736
|
+
return e ? "#4f7fa3" : xo;
|
|
4635
4737
|
}
|
|
4636
|
-
function
|
|
4738
|
+
function jo(e) {
|
|
4637
4739
|
return e ? 1 : .96;
|
|
4638
4740
|
}
|
|
4639
|
-
function
|
|
4741
|
+
function Mo(e, t) {
|
|
4640
4742
|
let n = document.createElement("canvas"), r = n.getContext("2d");
|
|
4641
4743
|
if (!r) throw Error("Could not create navigation cube label context");
|
|
4642
|
-
let i = `600 ${
|
|
4744
|
+
let i = `600 ${Co}px system-ui, "Segoe UI", sans-serif`;
|
|
4643
4745
|
r.font = i;
|
|
4644
|
-
let a = r.measureText(e), o = a.actualBoundingBoxAscent ||
|
|
4746
|
+
let a = r.measureText(e), o = a.actualBoundingBoxAscent || Co * .8, s = a.actualBoundingBoxDescent || Co * .2, c = Math.ceil(a.width + 36), l = Math.ceil(o + s + 20);
|
|
4645
4747
|
n.width = c, n.height = l, r.clearRect(0, 0, c, l), r.font = i, r.fillStyle = t, r.textAlign = "center", r.textBaseline = "alphabetic", r.fillText(e, c / 2, 10 + o);
|
|
4646
4748
|
let u = new b(n);
|
|
4647
4749
|
return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = M, u.minFilter = M, u.needsUpdate = !0, {
|
|
@@ -4649,12 +4751,12 @@ function So(e, t) {
|
|
|
4649
4751
|
texture: u
|
|
4650
4752
|
};
|
|
4651
4753
|
}
|
|
4652
|
-
function
|
|
4653
|
-
let { aspect: i, texture: a } = c(() =>
|
|
4754
|
+
function No({ color: e, label: t, position: n, rotation: r }) {
|
|
4755
|
+
let { aspect: i, texture: a } = c(() => Mo(t, e), [e, t]);
|
|
4654
4756
|
return o(() => () => a.dispose(), [a]), /* @__PURE__ */ R("mesh", {
|
|
4655
4757
|
position: n,
|
|
4656
4758
|
rotation: r,
|
|
4657
|
-
children: [/* @__PURE__ */ L("planeGeometry", { args: [
|
|
4759
|
+
children: [/* @__PURE__ */ L("planeGeometry", { args: [wo * i, wo] }), /* @__PURE__ */ L("meshBasicMaterial", {
|
|
4658
4760
|
alphaTest: .1,
|
|
4659
4761
|
depthWrite: !1,
|
|
4660
4762
|
map: a,
|
|
@@ -4663,41 +4765,41 @@ function Co({ color: e, label: t, position: n, rotation: r }) {
|
|
|
4663
4765
|
})]
|
|
4664
4766
|
});
|
|
4665
4767
|
}
|
|
4666
|
-
function
|
|
4768
|
+
function Po(e) {
|
|
4667
4769
|
return Math.abs(e.y) > .9 ? new I(0, 0, e.y > 0 ? -1 : 1) : new I(0, 1, 0);
|
|
4668
4770
|
}
|
|
4669
|
-
function
|
|
4771
|
+
function Fo(e, t) {
|
|
4670
4772
|
let n = e.current;
|
|
4671
|
-
return !n || (n.updateWorldMatrix(!0, !0),
|
|
4773
|
+
return !n || (n.updateWorldMatrix(!0, !0), To.setFromObject(n), To.isEmpty()) ? ($.center.copy(t), $.radius = 10, $) : (To.getBoundingSphere($), (!Number.isFinite($.radius) || $.radius <= 0) && ($.radius = 10), $);
|
|
4672
4774
|
}
|
|
4673
|
-
function
|
|
4775
|
+
function Io(e) {
|
|
4674
4776
|
return e.current?.getTarget(new I()) ?? new I();
|
|
4675
4777
|
}
|
|
4676
|
-
function
|
|
4677
|
-
let a =
|
|
4778
|
+
function Lo({ camera: e, controlRef: t, direction: n, modelRef: r, transitionRef: i }) {
|
|
4779
|
+
let a = Io(t), o = Fo(r, a), s = o.center.clone(), c = new I(...n).normalize(), l = e.position.distanceTo(a), u = Number.isFinite(l) && l > o.radius * .5 ? l : o.radius * 2.4, d = s.clone().addScaledVector(c, u);
|
|
4678
4780
|
t.current?.cancel(), t.current?.setFocalOffset(0, 0, 0, !1), i.current = {
|
|
4679
4781
|
endPosition: d,
|
|
4680
4782
|
endTarget: s,
|
|
4681
|
-
endUp:
|
|
4783
|
+
endUp: Po(c),
|
|
4682
4784
|
startPosition: e.position.clone(),
|
|
4683
4785
|
startTarget: a,
|
|
4684
4786
|
startTime: performance.now(),
|
|
4685
4787
|
startUp: e.up.clone()
|
|
4686
4788
|
};
|
|
4687
4789
|
}
|
|
4688
|
-
function
|
|
4790
|
+
function Ro({ action: e, onPick: t }) {
|
|
4689
4791
|
let [n, r] = u(!1);
|
|
4690
4792
|
return /* @__PURE__ */ R("group", {
|
|
4691
4793
|
position: e.position,
|
|
4692
|
-
onClick:
|
|
4794
|
+
onClick: ko,
|
|
4693
4795
|
onPointerDown: (n) => {
|
|
4694
|
-
|
|
4796
|
+
ko(n), t(e);
|
|
4695
4797
|
},
|
|
4696
4798
|
onPointerEnter: (e) => {
|
|
4697
|
-
|
|
4799
|
+
ko(e), r(!0);
|
|
4698
4800
|
},
|
|
4699
4801
|
onPointerLeave: (e) => {
|
|
4700
|
-
|
|
4802
|
+
ko(e), r(!1);
|
|
4701
4803
|
},
|
|
4702
4804
|
children: [/* @__PURE__ */ R("mesh", {
|
|
4703
4805
|
scale: e.scale,
|
|
@@ -4706,11 +4808,11 @@ function Oo({ action: e, onPick: t }) {
|
|
|
4706
4808
|
1,
|
|
4707
4809
|
1
|
|
4708
4810
|
] }), /* @__PURE__ */ L("meshBasicMaterial", {
|
|
4709
|
-
color:
|
|
4710
|
-
opacity:
|
|
4811
|
+
color: Ao(n),
|
|
4812
|
+
opacity: jo(n),
|
|
4711
4813
|
transparent: !0
|
|
4712
4814
|
})]
|
|
4713
|
-
}), e.label && /* @__PURE__ */ L(
|
|
4815
|
+
}), e.label && /* @__PURE__ */ L(No, {
|
|
4714
4816
|
color: n ? "#ffffff" : "#50606f",
|
|
4715
4817
|
label: e.label,
|
|
4716
4818
|
position: [
|
|
@@ -4722,11 +4824,11 @@ function Oo({ action: e, onPick: t }) {
|
|
|
4722
4824
|
})]
|
|
4723
4825
|
});
|
|
4724
4826
|
}
|
|
4725
|
-
function
|
|
4827
|
+
function zo({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
4726
4828
|
let i = l(null), a = l(null), o = c(() => [
|
|
4727
|
-
...
|
|
4728
|
-
...
|
|
4729
|
-
...
|
|
4829
|
+
...Eo,
|
|
4830
|
+
...Do(),
|
|
4831
|
+
...Oo()
|
|
4730
4832
|
], []);
|
|
4731
4833
|
return f(() => {
|
|
4732
4834
|
if (!e) return;
|
|
@@ -4735,7 +4837,7 @@ function ko({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
|
4735
4837
|
i.current && i.current.quaternion.copy(r.quaternion).invert();
|
|
4736
4838
|
let o = a.current;
|
|
4737
4839
|
if (!o) return;
|
|
4738
|
-
let s = performance.now() - o.startTime, c = Math.min(s /
|
|
4840
|
+
let s = performance.now() - o.startTime, c = Math.min(s / So, 1), l = 1 - (1 - c) ** 3, u = n.current;
|
|
4739
4841
|
if (r.position.lerpVectors(o.startPosition, o.endPosition, l), r.up.lerpVectors(o.startUp, o.endUp, l), u) {
|
|
4740
4842
|
let e = new I().lerpVectors(o.startTarget, o.endTarget, l);
|
|
4741
4843
|
u.setLookAt(r.position.x, r.position.y, r.position.z, e.x, e.y, e.z, !1);
|
|
@@ -4743,12 +4845,12 @@ function ko({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
|
4743
4845
|
c >= 1 && (r.up.copy(o.endUp), u?.setLookAt(o.endPosition.x, o.endPosition.y, o.endPosition.z, o.endTarget.x, o.endTarget.y, o.endTarget.z, !1), a.current = null);
|
|
4744
4846
|
}), e ? /* @__PURE__ */ L("group", {
|
|
4745
4847
|
ref: i,
|
|
4746
|
-
scale:
|
|
4747
|
-
children: o.map((e) => /* @__PURE__ */ L(
|
|
4848
|
+
scale: bo,
|
|
4849
|
+
children: o.map((e) => /* @__PURE__ */ L(Ro, {
|
|
4748
4850
|
action: e,
|
|
4749
4851
|
onPick: (e) => {
|
|
4750
4852
|
let i = t.current;
|
|
4751
|
-
i &&
|
|
4853
|
+
i && Lo({
|
|
4752
4854
|
camera: i,
|
|
4753
4855
|
controlRef: n,
|
|
4754
4856
|
direction: e.direction,
|
|
@@ -4761,13 +4863,13 @@ function ko({ active: e = !0, cameraRef: t, controlRef: n, modelRef: r }) {
|
|
|
4761
4863
|
}
|
|
4762
4864
|
//#endregion
|
|
4763
4865
|
//#region src/viewer/Viewer.tsx
|
|
4764
|
-
var
|
|
4866
|
+
var Bo = class {
|
|
4765
4867
|
sceneApi = null;
|
|
4766
4868
|
get = () => this.sceneApi;
|
|
4767
4869
|
set = (e) => {
|
|
4768
4870
|
this.sceneApi = e;
|
|
4769
4871
|
};
|
|
4770
|
-
},
|
|
4872
|
+
}, Vo = {
|
|
4771
4873
|
bottom: 16,
|
|
4772
4874
|
height: 96,
|
|
4773
4875
|
pointerEvents: "auto",
|
|
@@ -4776,11 +4878,11 @@ var Ao = class {
|
|
|
4776
4878
|
touchAction: "none",
|
|
4777
4879
|
width: 96,
|
|
4778
4880
|
zIndex: 2
|
|
4779
|
-
},
|
|
4881
|
+
}, Ho = {
|
|
4780
4882
|
height: "100%",
|
|
4781
4883
|
position: "relative",
|
|
4782
4884
|
width: "100%"
|
|
4783
|
-
},
|
|
4885
|
+
}, Uo = {
|
|
4784
4886
|
far: 50,
|
|
4785
4887
|
near: .1,
|
|
4786
4888
|
position: [
|
|
@@ -4789,20 +4891,30 @@ var Ao = class {
|
|
|
4789
4891
|
10
|
|
4790
4892
|
],
|
|
4791
4893
|
zoom: 72
|
|
4792
|
-
},
|
|
4894
|
+
}, Wo = {
|
|
4793
4895
|
alpha: !0,
|
|
4794
4896
|
antialias: !0
|
|
4795
|
-
},
|
|
4796
|
-
function
|
|
4897
|
+
}, Go = .1, Ko = .02, qo = 1e3, Jo = 50, Yo = .08, Xo = new g(), Zo = new de(), Qo = new I();
|
|
4898
|
+
function $o() {
|
|
4797
4899
|
let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
4798
4900
|
return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
|
|
4799
4901
|
}
|
|
4800
|
-
function
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4902
|
+
function es(e) {
|
|
4903
|
+
let t = ts(e);
|
|
4904
|
+
return t ? Math.max(t.radius * Ko, Go) : Go;
|
|
4905
|
+
}
|
|
4906
|
+
function ts(e) {
|
|
4907
|
+
if (!e || (Xo.setFromObject(e), Xo.isEmpty())) return null;
|
|
4908
|
+
let t = Xo.getBoundingSphere(Zo);
|
|
4909
|
+
return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
|
|
4910
|
+
}
|
|
4911
|
+
function ns(e, t) {
|
|
4912
|
+
let n = ts(t);
|
|
4913
|
+
if (!n) return;
|
|
4914
|
+
let r = Math.max(qo, n.radius * Jo, e.near + 1);
|
|
4915
|
+
Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
|
|
4804
4916
|
}
|
|
4805
|
-
function
|
|
4917
|
+
function rs(e, t, n, r, i) {
|
|
4806
4918
|
let a = n.elementIndex.get(i);
|
|
4807
4919
|
a && a.forEach((n) => {
|
|
4808
4920
|
let { record: i, vertexRanges: a } = n;
|
|
@@ -4814,37 +4926,37 @@ function Uo(e, t, n, r, i) {
|
|
|
4814
4926
|
}));
|
|
4815
4927
|
});
|
|
4816
4928
|
}
|
|
4817
|
-
function
|
|
4929
|
+
function is(e, t) {
|
|
4818
4930
|
let n = new g(), r = new I();
|
|
4819
4931
|
return Object.entries(e).forEach(([e, i]) => {
|
|
4820
4932
|
let a = Number(e);
|
|
4821
4933
|
i.forEach((e) => {
|
|
4822
|
-
|
|
4934
|
+
rs(n, r, t, a, e);
|
|
4823
4935
|
});
|
|
4824
4936
|
}), n.isEmpty() ? null : n;
|
|
4825
4937
|
}
|
|
4826
|
-
function
|
|
4827
|
-
let t = e.getSize(
|
|
4828
|
-
return Number.isFinite(n) && n > 0 ? n *
|
|
4938
|
+
function as(e) {
|
|
4939
|
+
let t = e.getSize(Qo), n = Math.max(t.x, t.y, t.z);
|
|
4940
|
+
return Number.isFinite(n) && n > 0 ? n * Yo : Go;
|
|
4829
4941
|
}
|
|
4830
|
-
function
|
|
4831
|
-
let g = p((e) => e.camera), _ =
|
|
4942
|
+
function os({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelRef: a, modelsData: s, onReady: u, publicApi: d, setSceneApi: f }) {
|
|
4943
|
+
let g = p((e) => e.camera), _ = Mt(a), v = Ut(_), { colorPaletteTexture: y, colorUtils: b } = Ge(_), x = Bn(a), S = vn(a, n, x), C = Nn(a, n, x), w = c(() => new ra(), []), T = v.buildIndex, E = _.resetIndex, D = b.applyStoredColors, O = Fr(), k = l(!1), A = z((e) => e.showStats), ee = c(() => {
|
|
4832
4944
|
let e = Object.keys(s).sort((e, t) => Number(e) - Number(t));
|
|
4833
4945
|
for (let t of e) {
|
|
4834
|
-
let e =
|
|
4946
|
+
let e = St(s[Number(t)]);
|
|
4835
4947
|
if (e) return e;
|
|
4836
4948
|
}
|
|
4837
4949
|
return null;
|
|
4838
|
-
}, [s]), j = c(() =>
|
|
4839
|
-
n.current && (n.current.minDistance =
|
|
4950
|
+
}, [s]), j = c(() => bt(ee ?? void 0), [ee]), M = c(() => Object.entries(s).map(([e, t]) => [Number(e), t]), [s]), te = i(() => {
|
|
4951
|
+
n.current && (n.current.minDistance = es(a.current));
|
|
4840
4952
|
}, [n, a]), N = i((e, t = !1) => {
|
|
4841
4953
|
let r = n.current;
|
|
4842
4954
|
if (!r) return;
|
|
4843
|
-
let i =
|
|
4955
|
+
let i = is(e, _.buildIndex());
|
|
4844
4956
|
if (!i) return;
|
|
4845
4957
|
let a = i.getCenter(new I());
|
|
4846
4958
|
if (r.cancel(), t) {
|
|
4847
|
-
let e =
|
|
4959
|
+
let e = as(i);
|
|
4848
4960
|
r.fitToBox(i, !0, {
|
|
4849
4961
|
paddingBottom: e,
|
|
4850
4962
|
paddingLeft: e,
|
|
@@ -4868,20 +4980,21 @@ function Ko({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelR
|
|
|
4868
4980
|
a,
|
|
4869
4981
|
s
|
|
4870
4982
|
]);
|
|
4871
|
-
return
|
|
4983
|
+
return Mr(a, n, x), Fn(), o(() => (x.setClippingSource(S), () => {
|
|
4872
4984
|
x.setClippingSource(null);
|
|
4873
4985
|
}), [x, S]), o(() => (t.current = g, () => {
|
|
4874
4986
|
t.current === g && (t.current = null);
|
|
4875
4987
|
}), [g, t]), o(() => {
|
|
4876
4988
|
if (!a.current) return;
|
|
4877
4989
|
let t = requestAnimationFrame(() => {
|
|
4878
|
-
a.current?.updateMatrixWorld(!0), te(), E(), T(), D(), S.syncWithModel(), C.syncWithModel(), e && O(a, n, r);
|
|
4990
|
+
a.current?.updateMatrixWorld(!0), (g instanceof se || g instanceof oe) && ns(g, a.current), te(), E(), T(), D(), S.syncWithModel(), C.syncWithModel(), e && O(a, n, r);
|
|
4879
4991
|
});
|
|
4880
4992
|
return () => cancelAnimationFrame(t);
|
|
4881
4993
|
}, [
|
|
4882
4994
|
D,
|
|
4883
4995
|
e,
|
|
4884
4996
|
T,
|
|
4997
|
+
g,
|
|
4885
4998
|
S,
|
|
4886
4999
|
n,
|
|
4887
5000
|
C,
|
|
@@ -4921,6 +5034,8 @@ function Ko({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelR
|
|
|
4921
5034
|
clearAllColors: b.clearAllColors,
|
|
4922
5035
|
clearColor: b.clearColor,
|
|
4923
5036
|
clearModelColors: b.clearModelColors,
|
|
5037
|
+
rebuildByColors: b.rebuildByColors,
|
|
5038
|
+
rebuildModelByColors: b.rebuildModelByColors,
|
|
4924
5039
|
setColor: b.setColor
|
|
4925
5040
|
},
|
|
4926
5041
|
converter: P,
|
|
@@ -4989,7 +5104,7 @@ function Ko({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelR
|
|
|
4989
5104
|
A && /* @__PURE__ */ L(h, {}),
|
|
4990
5105
|
/* @__PURE__ */ L("group", {
|
|
4991
5106
|
ref: a,
|
|
4992
|
-
children: M.map(([e, t]) => /* @__PURE__ */ L(
|
|
5107
|
+
children: M.map(([e, t]) => /* @__PURE__ */ L(wt, {
|
|
4993
5108
|
colorPaletteTexture: y,
|
|
4994
5109
|
coordinationMatrix: j,
|
|
4995
5110
|
data: t,
|
|
@@ -5000,13 +5115,13 @@ function Ko({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelR
|
|
|
5000
5115
|
dollyToCursor: !0,
|
|
5001
5116
|
draggingSmoothTime: .04,
|
|
5002
5117
|
infinityDolly: !0,
|
|
5003
|
-
minDistance:
|
|
5118
|
+
minDistance: Go,
|
|
5004
5119
|
ref: n,
|
|
5005
5120
|
smoothTime: .12
|
|
5006
5121
|
})
|
|
5007
5122
|
] });
|
|
5008
5123
|
}
|
|
5009
|
-
function
|
|
5124
|
+
function ss({ autoFitCamera: e = !0, camera: t = {
|
|
5010
5125
|
position: [
|
|
5011
5126
|
10,
|
|
5012
5127
|
10,
|
|
@@ -5014,9 +5129,9 @@ function qo({ autoFitCamera: e = !0, camera: t = {
|
|
|
5014
5129
|
],
|
|
5015
5130
|
fov: 50
|
|
5016
5131
|
}, dpr: n = window.devicePixelRatio, modelUrls: r, modelSources: i, modelsData: a, onReady: s, publicApi: c, setSceneApi: f, showNavCube: p, showStats: m }) {
|
|
5017
|
-
let h = l(null), g = l(null), _ = l(null), v = l(null), [y, b] = u(), x =
|
|
5132
|
+
let h = l(null), g = l(null), _ = l(null), v = l(null), [y, b] = u(), x = Ee(), S = z((e) => e.setModelNames), C = z((e) => e.setModelProps), w = z((e) => e.setModelStructure), T = z((e) => e.setShowNavCube), E = z((e) => e.setShowStats), D = z((e) => e.setUserDevice), O = z((e) => e.showNavCube), k = a ?? y;
|
|
5018
5133
|
return o(() => {
|
|
5019
|
-
D(
|
|
5134
|
+
D($o());
|
|
5020
5135
|
}, [D]), o(() => {
|
|
5021
5136
|
E(!!m);
|
|
5022
5137
|
}, [E, m]), o(() => {
|
|
@@ -5037,7 +5152,7 @@ function qo({ autoFitCamera: e = !0, camera: t = {
|
|
|
5037
5152
|
let e = i ?? r;
|
|
5038
5153
|
if (!e?.length) return;
|
|
5039
5154
|
let t = !0;
|
|
5040
|
-
return
|
|
5155
|
+
return mo.loadModel(e).then((e) => {
|
|
5041
5156
|
t && b(e);
|
|
5042
5157
|
}), () => {
|
|
5043
5158
|
t = !1;
|
|
@@ -5047,13 +5162,13 @@ function qo({ autoFitCamera: e = !0, camera: t = {
|
|
|
5047
5162
|
i,
|
|
5048
5163
|
r
|
|
5049
5164
|
]), k ? /* @__PURE__ */ R("div", {
|
|
5050
|
-
style:
|
|
5165
|
+
style: Ho,
|
|
5051
5166
|
children: [/* @__PURE__ */ L(d, {
|
|
5052
5167
|
camera: t,
|
|
5053
5168
|
dpr: n,
|
|
5054
|
-
children: /* @__PURE__ */ L(
|
|
5169
|
+
children: /* @__PURE__ */ L(Ir, {
|
|
5055
5170
|
store: x,
|
|
5056
|
-
children: /* @__PURE__ */ L(
|
|
5171
|
+
children: /* @__PURE__ */ L(os, {
|
|
5057
5172
|
autoFitCamera: e,
|
|
5058
5173
|
cameraRef: h,
|
|
5059
5174
|
controlRef: g,
|
|
@@ -5066,13 +5181,13 @@ function qo({ autoFitCamera: e = !0, camera: t = {
|
|
|
5066
5181
|
})
|
|
5067
5182
|
})
|
|
5068
5183
|
}), O && /* @__PURE__ */ L("div", {
|
|
5069
|
-
style:
|
|
5184
|
+
style: Vo,
|
|
5070
5185
|
children: /* @__PURE__ */ L(d, {
|
|
5071
|
-
camera:
|
|
5186
|
+
camera: Uo,
|
|
5072
5187
|
dpr: n,
|
|
5073
|
-
gl:
|
|
5188
|
+
gl: Wo,
|
|
5074
5189
|
orthographic: !0,
|
|
5075
|
-
children: /* @__PURE__ */ L(
|
|
5190
|
+
children: /* @__PURE__ */ L(zo, {
|
|
5076
5191
|
active: !0,
|
|
5077
5192
|
cameraRef: h,
|
|
5078
5193
|
controlRef: g,
|
|
@@ -5082,33 +5197,33 @@ function qo({ autoFitCamera: e = !0, camera: t = {
|
|
|
5082
5197
|
})]
|
|
5083
5198
|
}) : /* @__PURE__ */ L(Ce, {});
|
|
5084
5199
|
}
|
|
5085
|
-
var
|
|
5086
|
-
let [n] = u(
|
|
5200
|
+
var cs = n(function(e, t) {
|
|
5201
|
+
let [n] = u(Ae), r = l(!1), a = l(!1), d = c(() => new Bo(), []), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
|
|
5087
5202
|
d.set(e);
|
|
5088
|
-
}, [d]), g = c(() =>
|
|
5203
|
+
}, [d]), g = c(() => ba(n, d.get), [d, n]);
|
|
5089
5204
|
return s(t, () => g, [g]), o(() => (n.getState().setApi(g), () => {
|
|
5090
5205
|
n.getState().api === g && n.getState().setApi(null);
|
|
5091
5206
|
}), [g, n]), o(() => {
|
|
5092
|
-
r.current || !f || m !== void 0 || (r.current = !0, n.getState().setSelection(
|
|
5207
|
+
r.current || !f || m !== void 0 || (r.current = !0, n.getState().setSelection(ya(f)));
|
|
5093
5208
|
}, [
|
|
5094
5209
|
m,
|
|
5095
5210
|
f,
|
|
5096
5211
|
n
|
|
5097
5212
|
]), o(() => {
|
|
5098
|
-
m !== void 0 && (a.current = !0, n.getState().setSelection(
|
|
5213
|
+
m !== void 0 && (a.current = !0, n.getState().setSelection(ya(m)), a.current = !1);
|
|
5099
5214
|
}, [m, n]), o(() => {
|
|
5100
5215
|
if (p) return n.subscribe((e, t) => {
|
|
5101
|
-
e.selected !== t.selected && (a.current || p(
|
|
5216
|
+
e.selected !== t.selected && (a.current || p(va(e.selected)));
|
|
5102
5217
|
});
|
|
5103
|
-
}, [p, n]), /* @__PURE__ */ L(
|
|
5218
|
+
}, [p, n]), /* @__PURE__ */ L(Ir, {
|
|
5104
5219
|
store: n,
|
|
5105
|
-
children: /* @__PURE__ */ L(
|
|
5220
|
+
children: /* @__PURE__ */ L(ss, {
|
|
5106
5221
|
...e,
|
|
5107
5222
|
publicApi: g,
|
|
5108
5223
|
setSceneApi: h
|
|
5109
5224
|
})
|
|
5110
5225
|
});
|
|
5111
5226
|
});
|
|
5112
|
-
|
|
5227
|
+
cs.displayName = "Viewer";
|
|
5113
5228
|
//#endregion
|
|
5114
|
-
export {
|
|
5229
|
+
export { Sa as BMTLoader, ra as BmtConverter, aa as ConvertIfcFileToBmt, oa as ConvertToBmt, Tn as DimensionLine, Mn as DimensionsUtils, _a as FilteredElementsCollector, vt as ModelGrids, zo as NavigationCube, cs as Viewer, Ir as ViewerStoreProvider, ia as bmtConverter, qa as convertIfcFilesToBmtInWorker, Ja as createBmtConverterWorker, Ma as createBmtWorker, oo as createIfcWorker, Ae as createViewerStore, wi as exportExcel, xi as exportModelPropertiesToExcel, ja as loadBmtModelsInWorker, ao as loadIfcModelsInWorker, mo as loader, Nn as useDimensionsUtils, z as useViewerStore, Ee as useViewerStoreApi };
|