bimatter-viewer-react 0.5.12 → 0.6.0
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 +22 -0
- package/lib/{IFCLoader-B_gBDDmN.js → IFCLoader-RIJas-B5.js} +62 -41
- package/lib/Loaders/BmtConverter.d.ts +13 -0
- package/lib/Loaders/BmtLoader.d.ts +6 -0
- package/lib/Loaders/IFCLoader/IFCLoader.d.ts +3 -1
- package/lib/Loaders/IFCLoader/PropertySerializer.d.ts +9 -2
- package/lib/Model.d.ts +3 -1
- package/lib/SelectableMesh.d.ts +4 -1
- package/lib/Selector/useSelector.d.ts +2 -1
- package/lib/Viewer.d.ts +3 -0
- package/lib/api/loader.d.ts +4 -0
- package/lib/assets/{BmtConverterWorker-D4BQ-hoH.js → BmtConverterWorker-S83_KT6j.js} +1 -1
- package/lib/assets/{IFCWorker-Dgk5iwps.js → IFCWorker-GKoow6yV.js} +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +524 -347
- package/lib/types.d.ts +1 -0
- package/lib/workers/ProgressUtils.d.ts +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e, { createContext as t, forwardRef as n, memo as r, useCallback as i, useContext as a, useEffect as o, useImperativeHandle as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
2
2
|
import { Canvas as d, useFrame as f, useThree as p } from "@react-three/fiber";
|
|
3
3
|
import { CameraControls as m, Stats as h } from "@react-three/drei";
|
|
4
|
-
import { Box3 as g, BoxGeometry as _, BufferAttribute as v, BufferGeometry as y, CanvasTexture as b, Color as x, ConeGeometry as S, DataTexture as C, DoubleSide as w, DynamicDrawUsage as T, Float32BufferAttribute as E, Group as D, Line as
|
|
4
|
+
import { Box3 as g, BoxGeometry as _, BufferAttribute as v, BufferGeometry as y, CanvasTexture as b, Color as x, ConeGeometry as S, DataTexture as C, DoubleSide as w, DynamicDrawUsage as T, Float32BufferAttribute as E, Group as D, Line as ee, Line3 as te, LineBasicMaterial as ne, LineDashedMaterial as O, LineSegments as k, LinearFilter as A, MathUtils as re, Matrix4 as j, Mesh as M, MeshBasicMaterial as N, MeshLambertMaterial as P, NearestFilter as ie, Object3D as ae, OrthographicCamera as oe, PerspectiveCamera as se, Plane as ce, RGBAFormat as le, SRGBColorSpace as ue, Sphere as de, SphereGeometry as fe, Sprite as pe, SpriteMaterial as me, UnsignedByteType as he, Vector2 as F, Vector3 as I } from "three";
|
|
5
5
|
import { useStore as ge } from "zustand";
|
|
6
6
|
import { createStore as _e } from "zustand/vanilla";
|
|
7
7
|
import { CONTAINED as ve, INTERSECTED as ye, MeshBVH as be, NOT_INTERSECTED as xe, acceleratedRaycast as Se } from "three-mesh-bvh";
|
|
@@ -280,23 +280,25 @@ function Ge(e) {
|
|
|
280
280
|
}
|
|
281
281
|
//#endregion
|
|
282
282
|
//#region src/viewer/SelectableMesh.tsx
|
|
283
|
-
|
|
284
|
-
var Ke = e.memo(function({ colorPaletteTexture: e, material: t,
|
|
285
|
-
let
|
|
286
|
-
|
|
287
|
-
let
|
|
288
|
-
let
|
|
283
|
+
M.prototype.raycast = Se;
|
|
284
|
+
var Ke = e.memo(function({ colorPaletteTexture: e, material: t, materialMode: n = "quality", data: r, isIfcSpace: i = !1, meshMatrix: a, useDoubleSideMaterial: s = !1 }) {
|
|
285
|
+
let u = l(null), d = z((e) => e.preselectionColor), f = l(d);
|
|
286
|
+
f.current = d;
|
|
287
|
+
let p = c(() => {
|
|
288
|
+
let r = {
|
|
289
289
|
color: new x(t.r, t.g, t.b),
|
|
290
290
|
transparent: !!(t.opacity && t.opacity != 1),
|
|
291
|
-
opacity: t.opacity ?? 1
|
|
291
|
+
opacity: t.opacity ?? 1
|
|
292
|
+
}, i = s ? {
|
|
293
|
+
...r,
|
|
292
294
|
side: w
|
|
293
|
-
}),
|
|
294
|
-
return
|
|
295
|
-
...
|
|
295
|
+
} : r, a = n === "performance" ? new N(i) : new P(i), o = a;
|
|
296
|
+
return o.defaultAttributeValues = {
|
|
297
|
+
...o.defaultAttributeValues,
|
|
296
298
|
colorIndex: [0]
|
|
297
|
-
},
|
|
298
|
-
let
|
|
299
|
-
|
|
299
|
+
}, a.onBeforeCompile = (n) => {
|
|
300
|
+
let r = new x(f.current);
|
|
301
|
+
n.uniforms.baseColor = { value: new x(t.r, t.g, t.b) }, n.uniforms.preSelectionColor = { value: r }, n.uniforms.preSelectionId = { value: -1 }, n.uniforms.elementColorPalette = { value: e }, n.vertexShader = n.vertexShader.replace("#include <common>", "\n #include <common>\n attribute float colorIndex;\n attribute uint ids;\n flat varying float vColorIndex;\n flat varying float vPreselectId;\n "), n.vertexShader = n.vertexShader.replace("#include <begin_vertex>", "\n #include <begin_vertex>\n vColorIndex = colorIndex;\n vPreselectId = float(ids);\n "), n.fragmentShader = n.fragmentShader.replace("#include <common>", "\n #include <common>\n uniform vec3 baseColor;\n uniform vec3 preSelectionColor;\n uniform sampler2D elementColorPalette;\n flat varying float vPreselectId;\n flat varying float vColorIndex;\n uniform float preSelectionId;\n "), n.fragmentShader = n.fragmentShader.replace("vec4 diffuseColor = vec4( diffuse, opacity );", `
|
|
300
302
|
vec4 diffuseColor;
|
|
301
303
|
if(preSelectionId == vPreselectId && abs(vColorIndex - 1.0) > 0.5){
|
|
302
304
|
diffuseColor = vec4(preSelectionColor, 1.0);
|
|
@@ -311,24 +313,29 @@ var Ke = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSp
|
|
|
311
313
|
else{
|
|
312
314
|
diffuseColor = vec4(baseColor, opacity);
|
|
313
315
|
}
|
|
314
|
-
`),
|
|
315
|
-
},
|
|
316
|
-
}, [
|
|
316
|
+
`), a.userData.shader = n;
|
|
317
|
+
}, a;
|
|
318
|
+
}, [
|
|
319
|
+
e,
|
|
320
|
+
t,
|
|
321
|
+
n,
|
|
322
|
+
s
|
|
323
|
+
]);
|
|
317
324
|
return o(() => {
|
|
318
|
-
let e =
|
|
319
|
-
e && (e.value instanceof x ? e.value.set(
|
|
320
|
-
}, [
|
|
321
|
-
if (!
|
|
322
|
-
let e =
|
|
325
|
+
let e = p.userData.shader?.uniforms.preSelectionColor;
|
|
326
|
+
e && (e.value instanceof x ? e.value.set(d) : e.value = new x(d));
|
|
327
|
+
}, [p, d]), o(() => {
|
|
328
|
+
if (!u.current) return;
|
|
329
|
+
let e = u.current.geometry, t = new be(e, { indirect: !0 });
|
|
323
330
|
return Object.assign(e, { boundsTree: t }), () => {
|
|
324
|
-
|
|
331
|
+
p.dispose(), Object.assign(e, { boundsTree: null });
|
|
325
332
|
};
|
|
326
|
-
}, [
|
|
327
|
-
matrix:
|
|
333
|
+
}, [p]), /* @__PURE__ */ R("mesh", {
|
|
334
|
+
matrix: a,
|
|
328
335
|
matrixAutoUpdate: !1,
|
|
329
|
-
name:
|
|
330
|
-
ref:
|
|
331
|
-
userData: { isIfcSpace:
|
|
336
|
+
name: i ? "space" : void 0,
|
|
337
|
+
ref: u,
|
|
338
|
+
userData: { isIfcSpace: i },
|
|
332
339
|
onPointerLeave: (e) => {
|
|
333
340
|
let t = e.object;
|
|
334
341
|
t.preselected &&= !1;
|
|
@@ -336,21 +343,21 @@ var Ke = e.memo(function({ colorPaletteTexture: e, material: t, data: n, isIfcSp
|
|
|
336
343
|
children: [/* @__PURE__ */ R("bufferGeometry", { children: [
|
|
337
344
|
/* @__PURE__ */ L("bufferAttribute", {
|
|
338
345
|
attach: "attributes-position",
|
|
339
|
-
args: [
|
|
346
|
+
args: [r.pos, 3]
|
|
340
347
|
}),
|
|
341
|
-
|
|
348
|
+
r.norm && /* @__PURE__ */ L("bufferAttribute", {
|
|
342
349
|
attach: "attributes-normal",
|
|
343
|
-
args: [
|
|
350
|
+
args: [r.norm, 3]
|
|
344
351
|
}),
|
|
345
352
|
/* @__PURE__ */ L("bufferAttribute", {
|
|
346
353
|
attach: "attributes-ids",
|
|
347
|
-
args: [
|
|
354
|
+
args: [r.ids, 1]
|
|
348
355
|
}),
|
|
349
356
|
/* @__PURE__ */ L("bufferAttribute", {
|
|
350
357
|
attach: "index",
|
|
351
|
-
args: [
|
|
358
|
+
args: [r.ind, 1]
|
|
352
359
|
})
|
|
353
|
-
] }), /* @__PURE__ */ L("primitive", { object:
|
|
360
|
+
] }), /* @__PURE__ */ L("primitive", { object: p })]
|
|
354
361
|
});
|
|
355
362
|
}), qe = 10, Je = "#1d2733", Ye = 2, Xe = .05, Ze = "\0", Qe = /* @__PURE__ */ new Map();
|
|
356
363
|
function $e() {
|
|
@@ -364,7 +371,7 @@ function et(e, t, n, r) {
|
|
|
364
371
|
let u = o.measureText(t), d = u.actualBoundingBoxAscent || r * .8, f = u.actualBoundingBoxDescent || r * .2, p = Math.max(1, Math.ceil(u.width + c * 2)), m = Math.max(1, Math.ceil(d + f + l * 2));
|
|
365
372
|
a.width = Math.ceil(p * i), a.height = Math.ceil(m * i), o.scale(i, i), o.clearRect(0, 0, p, m), o.font = s, o.fillStyle = n, o.textAlign = "left", o.textBaseline = "alphabetic", o.fillText(t, c, l + d);
|
|
366
373
|
let h = new b(a);
|
|
367
|
-
return h.colorSpace = ue, h.generateMipmaps = !1, h.magFilter =
|
|
374
|
+
return h.colorSpace = ue, h.generateMipmaps = !1, h.magFilter = A, h.minFilter = A, h.needsUpdate = !0, {
|
|
368
375
|
disposeTimer: null,
|
|
369
376
|
height: m,
|
|
370
377
|
key: e,
|
|
@@ -622,12 +629,12 @@ function vt({ color: e, floorY: t, fontSize: n = qe, grids: r, labelOffset: i =
|
|
|
622
629
|
}
|
|
623
630
|
//#endregion
|
|
624
631
|
//#region src/viewer/Model.tsx
|
|
625
|
-
var yt = new
|
|
632
|
+
var yt = new j();
|
|
626
633
|
function bt(e) {
|
|
627
634
|
if (!e) return null;
|
|
628
635
|
try {
|
|
629
636
|
let t = JSON.parse(e);
|
|
630
|
-
return !Array.isArray(t) || t.length !== 16 ? null : new
|
|
637
|
+
return !Array.isArray(t) || t.length !== 16 ? null : new j().fromArray(t);
|
|
631
638
|
} catch (e) {
|
|
632
639
|
return console.warn("Model matrix parsing error", e), null;
|
|
633
640
|
}
|
|
@@ -638,8 +645,8 @@ function xt(e) {
|
|
|
638
645
|
function St(e) {
|
|
639
646
|
return e.coordinationMatrix ?? Object.values(e.data)[0]?.matrix;
|
|
640
647
|
}
|
|
641
|
-
function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r }) {
|
|
642
|
-
let
|
|
648
|
+
function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r, materialMode: i }) {
|
|
649
|
+
let a = z((e) => e.gridAxesVisibility), o = c(() => {
|
|
643
650
|
if (!r) return {
|
|
644
651
|
data: [],
|
|
645
652
|
coordinationMatrix: null,
|
|
@@ -648,7 +655,7 @@ function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
648
655
|
let e = Object.values(r.data).some((e) => !!e.matrix) ? t?.clone() ?? xt(r) : null, i = Infinity, a = new I();
|
|
649
656
|
return {
|
|
650
657
|
data: Object.values(r.data).map((e) => {
|
|
651
|
-
let t = (bt(e.matrix) ?? new
|
|
658
|
+
let t = (bt(e.matrix) ?? new j()).clone().invert(), r = e.mat, o = e.pos;
|
|
652
659
|
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));
|
|
653
660
|
return {
|
|
654
661
|
data: e,
|
|
@@ -666,26 +673,30 @@ function Ct({ colorPaletteTexture: e, coordinationMatrix: t, modelID: n, data: r
|
|
|
666
673
|
r,
|
|
667
674
|
n
|
|
668
675
|
]);
|
|
669
|
-
|
|
670
|
-
|
|
676
|
+
if (!r) return /* @__PURE__ */ L(Ce, {});
|
|
677
|
+
let s = i ?? r.renderSettings?.materialMode ?? "quality", l = r.renderSettings?.useDoubleSideMaterial === !0;
|
|
678
|
+
return /* @__PURE__ */ R("group", {
|
|
679
|
+
matrix: o.coordinationMatrix ?? yt,
|
|
671
680
|
matrixAutoUpdate: !1,
|
|
672
681
|
userData: { modelID: n },
|
|
673
|
-
children: [
|
|
682
|
+
children: [o.data.map(({ data: t, isIfcSpace: n, key: r, material: i, meshMatrix: a }) => /* @__PURE__ */ L(Ke, {
|
|
674
683
|
colorPaletteTexture: e,
|
|
675
684
|
material: i,
|
|
685
|
+
materialMode: s,
|
|
676
686
|
data: t,
|
|
677
687
|
isIfcSpace: n,
|
|
678
|
-
meshMatrix: a
|
|
688
|
+
meshMatrix: a,
|
|
689
|
+
useDoubleSideMaterial: l
|
|
679
690
|
}, r)), /* @__PURE__ */ L(vt, {
|
|
680
|
-
floorY:
|
|
691
|
+
floorY: o.floorY,
|
|
681
692
|
grids: r.grids,
|
|
682
|
-
showBottom:
|
|
683
|
-
showLeft:
|
|
684
|
-
showRight:
|
|
685
|
-
showTop:
|
|
686
|
-
visible:
|
|
693
|
+
showBottom: a.bottom,
|
|
694
|
+
showLeft: a.left,
|
|
695
|
+
showRight: a.right,
|
|
696
|
+
showTop: a.top,
|
|
697
|
+
visible: a.visible
|
|
687
698
|
})]
|
|
688
|
-
})
|
|
699
|
+
});
|
|
689
700
|
}
|
|
690
701
|
var wt = r(Ct);
|
|
691
702
|
//#endregion
|
|
@@ -744,7 +755,7 @@ function Mt(e) {
|
|
|
744
755
|
if (!n || r.indexedModel === n && r.records.size) return r;
|
|
745
756
|
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
746
757
|
return n.traverse((e) => {
|
|
747
|
-
if (!(e instanceof
|
|
758
|
+
if (!(e instanceof M)) return;
|
|
748
759
|
let t = e, n = t.geometry, r = n.index, o = n.attributes.ids;
|
|
749
760
|
if (!r || !o) return;
|
|
750
761
|
let s = At(t), c = Et(r.array), l = {
|
|
@@ -964,7 +975,7 @@ function qt(e) {
|
|
|
964
975
|
function Jt(e, t) {
|
|
965
976
|
let n = new y(), r = Math.ceil(Math.min(Math.max(Wt, qt(t) * .05), 32768));
|
|
966
977
|
n.setAttribute("position", Kt(r)), n.setDrawRange(0, 0);
|
|
967
|
-
let i = new
|
|
978
|
+
let i = new k(n, e);
|
|
968
979
|
return i.frustumCulled = !1, i.renderOrder = 1, i.visible = !1, i;
|
|
969
980
|
}
|
|
970
981
|
function Yt(e, t) {
|
|
@@ -982,9 +993,9 @@ var Zt = class {
|
|
|
982
993
|
plane;
|
|
983
994
|
context;
|
|
984
995
|
lines = /* @__PURE__ */ new Map();
|
|
985
|
-
inverseMatrix = new
|
|
996
|
+
inverseMatrix = new j();
|
|
986
997
|
localPlane = new ce();
|
|
987
|
-
tempLine = new
|
|
998
|
+
tempLine = new te();
|
|
988
999
|
tempVector = new I();
|
|
989
1000
|
tempVector1 = new I();
|
|
990
1001
|
tempVector2 = new I();
|
|
@@ -995,7 +1006,7 @@ var Zt = class {
|
|
|
995
1006
|
e.plane === t || n.includes(t) || (e.material.clippingPlanes = [...n, t], e.material.needsUpdate = !0);
|
|
996
1007
|
});
|
|
997
1008
|
let n = e.planes.filter((e) => e !== t);
|
|
998
|
-
this.material = new
|
|
1009
|
+
this.material = new ne({
|
|
999
1010
|
clippingPlanes: n,
|
|
1000
1011
|
color: "black",
|
|
1001
1012
|
depthTest: !0,
|
|
@@ -1074,7 +1085,7 @@ var fn = class extends ae {
|
|
|
1074
1085
|
hovered = !1;
|
|
1075
1086
|
listenersActive = !1;
|
|
1076
1087
|
constructor(e, t, n, r) {
|
|
1077
|
-
super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new
|
|
1088
|
+
super(), this.context = e, this.plane = t, this.location = n.clone(), this.normal = r.clone().normalize(), this.material = new N({
|
|
1078
1089
|
color: $t,
|
|
1079
1090
|
depthWrite: !1,
|
|
1080
1091
|
opacity: en,
|
|
@@ -1082,7 +1093,7 @@ var fn = class extends ae {
|
|
|
1082
1093
|
transparent: !0
|
|
1083
1094
|
}), this.helper.position.copy(this.location), this.applyPlaneOrientation(), this.layout = this.getHelperLayout();
|
|
1084
1095
|
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);
|
|
1085
|
-
this.borderMaterial = new
|
|
1096
|
+
this.borderMaterial = new O({
|
|
1086
1097
|
color: Qt,
|
|
1087
1098
|
dashSize: i,
|
|
1088
1099
|
depthWrite: !1,
|
|
@@ -1149,7 +1160,7 @@ var fn = class extends ae {
|
|
|
1149
1160
|
hasModelIntersection(e) {
|
|
1150
1161
|
return !!this.context.getCameraUtils().getIntersection(!0, {
|
|
1151
1162
|
event: e,
|
|
1152
|
-
filter: (e) => !(e.object instanceof
|
|
1163
|
+
filter: (e) => !(e.object instanceof M) || e.faceIndex === void 0 || e.faceIndex === null ? !1 : !!(e.object.geometry.index && e.object.geometry.attributes.ids),
|
|
1153
1164
|
object: this.context.getMeshes(),
|
|
1154
1165
|
recursive: !1
|
|
1155
1166
|
});
|
|
@@ -1216,11 +1227,11 @@ var fn = class extends ae {
|
|
|
1216
1227
|
this.hovered = e, this.material.color.set(e ? tn : $t), this.material.opacity = e ? nn : en, this.material.needsUpdate = !0;
|
|
1217
1228
|
}
|
|
1218
1229
|
createPlaneMesh() {
|
|
1219
|
-
let e = new
|
|
1230
|
+
let e = new M(new y(), this.material);
|
|
1220
1231
|
return e.renderOrder = 2, e;
|
|
1221
1232
|
}
|
|
1222
1233
|
createBorder() {
|
|
1223
|
-
let e = new
|
|
1234
|
+
let e = new k(new y(), this.borderMaterial);
|
|
1224
1235
|
return e.renderOrder = 3, e;
|
|
1225
1236
|
}
|
|
1226
1237
|
replaceGeometry(e, t) {
|
|
@@ -1327,7 +1338,7 @@ var fn = class extends ae {
|
|
|
1327
1338
|
};
|
|
1328
1339
|
}
|
|
1329
1340
|
applyPlaneOrientation() {
|
|
1330
|
-
let e = this.getPlaneBasis(), t = new
|
|
1341
|
+
let e = this.getPlaneBasis(), t = new j().makeBasis(e.u, e.v, this.normal);
|
|
1331
1342
|
this.helper.quaternion.setFromRotationMatrix(t);
|
|
1332
1343
|
}
|
|
1333
1344
|
getModelWorldBox() {
|
|
@@ -1365,7 +1376,7 @@ function pn(e, t) {
|
|
|
1365
1376
|
function mn(e) {
|
|
1366
1377
|
let t = [];
|
|
1367
1378
|
return e?.traverse((e) => {
|
|
1368
|
-
e instanceof
|
|
1379
|
+
e instanceof M && (!e.geometry.index || !e.geometry.attributes.ids || t.push(e));
|
|
1369
1380
|
}), t;
|
|
1370
1381
|
}
|
|
1371
1382
|
function hn(e) {
|
|
@@ -1672,7 +1683,7 @@ function wn(e) {
|
|
|
1672
1683
|
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));
|
|
1673
1684
|
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);
|
|
1674
1685
|
let u = new b(n);
|
|
1675
|
-
return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter =
|
|
1686
|
+
return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = A, u.minFilter = A, u.needsUpdate = !0, {
|
|
1676
1687
|
height: l,
|
|
1677
1688
|
texture: u,
|
|
1678
1689
|
width: c
|
|
@@ -1708,7 +1719,7 @@ var Tn = class e {
|
|
|
1708
1719
|
this.end.x,
|
|
1709
1720
|
this.end.y,
|
|
1710
1721
|
this.end.z
|
|
1711
|
-
], 3)), this.line = new
|
|
1722
|
+
], 3)), this.line = new ee(this.lineGeometry, this.lineMaterial), this.line.renderOrder = 4, this.line.computeLineDistances(), this.root.add(this.line), this.addEndpointMeshes(), this.labelSprite = this.createLabelSprite(), this.root.add(this.labelSprite), this.updateLabel(), this.updatePositions(), this.ownerRoot.add(this.root);
|
|
1712
1723
|
}
|
|
1713
1724
|
get length() {
|
|
1714
1725
|
return this.start.distanceTo(this.end);
|
|
@@ -1750,7 +1761,7 @@ var Tn = class e {
|
|
|
1750
1761
|
this.addEndpointMesh(this.start, this.end), this.addEndpointMesh(this.end, this.start);
|
|
1751
1762
|
}
|
|
1752
1763
|
addEndpointMesh(e, t) {
|
|
1753
|
-
let n = new
|
|
1764
|
+
let n = new M(this.endpointGeometry, this.endpointMaterial);
|
|
1754
1765
|
n.position.copy(e), n.scale.copy(this.endpointBaseScale), n.lookAt(t), n.renderOrder = 4, this.endpointMeshes.push(n), this.root.add(n);
|
|
1755
1766
|
}
|
|
1756
1767
|
createLabelSprite() {
|
|
@@ -1762,7 +1773,7 @@ var Tn = class e {
|
|
|
1762
1773
|
return e.renderOrder = 5, e;
|
|
1763
1774
|
}
|
|
1764
1775
|
createBoundingBoxMesh() {
|
|
1765
|
-
let e = new
|
|
1776
|
+
let e = new M(new _(1, 1, Math.max(this.length, .001)), this.boundingMaterial);
|
|
1766
1777
|
return e.renderOrder = 3, e;
|
|
1767
1778
|
}
|
|
1768
1779
|
getTextContent() {
|
|
@@ -1800,7 +1811,7 @@ var Tn = class e {
|
|
|
1800
1811
|
function kn(e) {
|
|
1801
1812
|
let t = [];
|
|
1802
1813
|
return e?.traverse((e) => {
|
|
1803
|
-
e instanceof
|
|
1814
|
+
e instanceof M && e.geometry.attributes.position && t.push(e);
|
|
1804
1815
|
}), t;
|
|
1805
1816
|
}
|
|
1806
1817
|
function An(e, t, n) {
|
|
@@ -1814,7 +1825,7 @@ function jn(e, t) {
|
|
|
1814
1825
|
var Mn = class e {
|
|
1815
1826
|
active = !1;
|
|
1816
1827
|
axis = null;
|
|
1817
|
-
boundingMaterial = new
|
|
1828
|
+
boundingMaterial = new N({
|
|
1818
1829
|
color: 0,
|
|
1819
1830
|
depthTest: !1,
|
|
1820
1831
|
depthWrite: !1,
|
|
@@ -1825,13 +1836,13 @@ var Mn = class e {
|
|
|
1825
1836
|
currentDimension = null;
|
|
1826
1837
|
dimensions = [];
|
|
1827
1838
|
endpointGeometry = e.createEndpointGeometry();
|
|
1828
|
-
endpointMaterial = new
|
|
1839
|
+
endpointMaterial = new N({
|
|
1829
1840
|
color: En,
|
|
1830
1841
|
depthTest: !1,
|
|
1831
1842
|
depthWrite: !1
|
|
1832
1843
|
});
|
|
1833
1844
|
endpointScale = new I(1, 1, 1);
|
|
1834
|
-
lineMaterial = new
|
|
1845
|
+
lineMaterial = new O({
|
|
1835
1846
|
color: En,
|
|
1836
1847
|
dashSize: .2,
|
|
1837
1848
|
depthTest: !1,
|
|
@@ -1840,7 +1851,7 @@ var Mn = class e {
|
|
|
1840
1851
|
});
|
|
1841
1852
|
measureInProcess = !1;
|
|
1842
1853
|
moveState = "end";
|
|
1843
|
-
previewMarker = new
|
|
1854
|
+
previewMarker = new M(e.createPreviewGeometry(), new N({
|
|
1844
1855
|
color: 0,
|
|
1845
1856
|
depthTest: !1,
|
|
1846
1857
|
depthWrite: !1
|
|
@@ -1980,7 +1991,7 @@ var Mn = class e {
|
|
|
1980
1991
|
return this.dimensions.map((e) => e.boundingBox).filter((e) => !!e);
|
|
1981
1992
|
}
|
|
1982
1993
|
getClosestVertex(e) {
|
|
1983
|
-
if (!(e.object instanceof
|
|
1994
|
+
if (!(e.object instanceof M) || !e.face) return e.point.clone();
|
|
1984
1995
|
let t = e.object.geometry.attributes.position;
|
|
1985
1996
|
if (!t) return e.point.clone();
|
|
1986
1997
|
let n = [
|
|
@@ -2471,144 +2482,148 @@ function Ar(e) {
|
|
|
2471
2482
|
return !0;
|
|
2472
2483
|
}
|
|
2473
2484
|
function jr(e) {
|
|
2474
|
-
if (!Ar(e.object) || !(e.object instanceof
|
|
2485
|
+
if (!Ar(e.object) || !(e.object instanceof M) || e.faceIndex === void 0 || e.faceIndex === null) return !1;
|
|
2475
2486
|
let t = e.object.geometry;
|
|
2476
2487
|
return !!(t.index && t.attributes.ids);
|
|
2477
2488
|
}
|
|
2478
|
-
function Mr(e, t, n) {
|
|
2479
|
-
let
|
|
2489
|
+
function Mr(e, t, n, r) {
|
|
2490
|
+
let i = l("end"), a = z((e) => e.selected), s = z((e) => e.setSelected), c = z((e) => e.addSelected), u = z((e) => e.removeSelected), d = z((e) => e.showStats), f = Ee(), m = l(null), h = l(null), g = l(!1), _ = l(!1), v = l("add"), y = l(null), b = l(!1), x = l(0), S = l(null), C = l(null), w = () => f.getState().selectionInteractionDisabled, T = (e) => {
|
|
2491
|
+
if (r) {
|
|
2492
|
+
r(e);
|
|
2493
|
+
return;
|
|
2494
|
+
}
|
|
2480
2495
|
let n = t.current;
|
|
2481
2496
|
n && (n.cancel(), n.setOrbitPoint(e.x, e.y, e.z));
|
|
2482
|
-
},
|
|
2497
|
+
}, E = () => {
|
|
2483
2498
|
e.current?.traverse((e) => {
|
|
2484
|
-
if (!(e instanceof
|
|
2499
|
+
if (!(e instanceof M)) return;
|
|
2485
2500
|
let t = e;
|
|
2486
2501
|
t.preselected = !1, Dr(t.material, -1);
|
|
2487
2502
|
});
|
|
2488
|
-
},
|
|
2489
|
-
|
|
2490
|
-
},
|
|
2491
|
-
if (
|
|
2492
|
-
|
|
2503
|
+
}, D = () => {
|
|
2504
|
+
m.current = null, g.current = !1, wr(h), t.current && (t.current.enabled = !0);
|
|
2505
|
+
}, ee = (t) => {
|
|
2506
|
+
if (w()) {
|
|
2507
|
+
E();
|
|
2493
2508
|
return;
|
|
2494
2509
|
}
|
|
2495
|
-
if (
|
|
2496
|
-
|
|
2510
|
+
if (m.current) {
|
|
2511
|
+
E();
|
|
2497
2512
|
return;
|
|
2498
2513
|
}
|
|
2499
|
-
if (
|
|
2500
|
-
|
|
2514
|
+
if (i.current !== "end" && i.current !== "start") {
|
|
2515
|
+
E();
|
|
2501
2516
|
return;
|
|
2502
2517
|
}
|
|
2503
|
-
let n =
|
|
2504
|
-
n && (
|
|
2505
|
-
if (!(e instanceof
|
|
2518
|
+
let n = oe(t, e.current)[0], r;
|
|
2519
|
+
n && (r = n.object), E(), !(!n || !r) && e.current?.traverse((e) => {
|
|
2520
|
+
if (!(e instanceof M)) return;
|
|
2506
2521
|
let t = e;
|
|
2507
|
-
if (t !==
|
|
2508
|
-
let
|
|
2522
|
+
if (t !== r) return;
|
|
2523
|
+
let i = n.faceIndex * 3, a = t.geometry.index.getX(i), o = t.geometry.attributes.ids.getX(a);
|
|
2509
2524
|
t.preselected = !0, Dr(t.material, o);
|
|
2510
2525
|
});
|
|
2511
2526
|
};
|
|
2512
|
-
function
|
|
2527
|
+
function te() {
|
|
2513
2528
|
return performance.now();
|
|
2514
2529
|
}
|
|
2515
|
-
let
|
|
2516
|
-
if (
|
|
2517
|
-
|
|
2530
|
+
let ne = (e) => {
|
|
2531
|
+
if (w()) {
|
|
2532
|
+
C.current = null, S.current !== null && (window.clearTimeout(S.current), S.current = null), E();
|
|
2518
2533
|
return;
|
|
2519
2534
|
}
|
|
2520
|
-
if (
|
|
2521
|
-
let t =
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
let e =
|
|
2525
|
-
|
|
2535
|
+
if (C.current = e, S.current !== null) return;
|
|
2536
|
+
let t = te() - x.current, n = Math.max(0, Tr - t);
|
|
2537
|
+
S.current = window.setTimeout(() => {
|
|
2538
|
+
S.current = null;
|
|
2539
|
+
let e = C.current;
|
|
2540
|
+
C.current = null, e && (x.current = performance.now(), ee(e));
|
|
2526
2541
|
}, n);
|
|
2527
|
-
},
|
|
2542
|
+
}, O = l(null);
|
|
2528
2543
|
o(() => {
|
|
2529
|
-
let e =
|
|
2544
|
+
let e = y.current;
|
|
2530
2545
|
if (e) {
|
|
2531
|
-
|
|
2546
|
+
d && O.current !== null && console.log(`selection ${e.action}:`, Date.now() - O.current, "ms"), y.current = null, O.current = null;
|
|
2532
2547
|
return;
|
|
2533
2548
|
}
|
|
2534
|
-
|
|
2535
|
-
}, [
|
|
2536
|
-
let { camera:
|
|
2537
|
-
function
|
|
2549
|
+
d && O.current !== null && (console.log("selection spend:", Date.now() - O.current, "ms"), O.current = null);
|
|
2550
|
+
}, [a, d]);
|
|
2551
|
+
let { camera: k, gl: A } = p();
|
|
2552
|
+
function re() {
|
|
2538
2553
|
return Date.now();
|
|
2539
2554
|
}
|
|
2540
|
-
let
|
|
2541
|
-
let t =
|
|
2555
|
+
let j = (e) => {
|
|
2556
|
+
let t = A.domElement.getBoundingClientRect();
|
|
2542
2557
|
return e.clientX >= t.left && e.clientX <= t.right && e.clientY >= t.top && e.clientY <= t.bottom;
|
|
2543
2558
|
}, N = (t) => {
|
|
2544
|
-
if (
|
|
2545
|
-
|
|
2559
|
+
if (w()) {
|
|
2560
|
+
b.current = !1, _.current = !1, E();
|
|
2546
2561
|
return;
|
|
2547
2562
|
}
|
|
2548
|
-
if (!
|
|
2549
|
-
if (
|
|
2550
|
-
|
|
2563
|
+
if (!b.current) return;
|
|
2564
|
+
if (b.current = !1, _.current) {
|
|
2565
|
+
_.current = !1;
|
|
2551
2566
|
return;
|
|
2552
2567
|
}
|
|
2553
|
-
if (!
|
|
2554
|
-
if (
|
|
2555
|
-
|
|
2568
|
+
if (!j(t)) return;
|
|
2569
|
+
if (O.current = re(), i.current !== "end" && i.current !== "start" && i.current > 15) {
|
|
2570
|
+
i.current = "end";
|
|
2556
2571
|
return;
|
|
2557
2572
|
}
|
|
2558
|
-
let n = t.shiftKey,
|
|
2559
|
-
if (
|
|
2560
|
-
let e =
|
|
2573
|
+
let n = t.shiftKey, r = t.ctrlKey, o = oe(t, e.current), l, d = Or(e), f = null;
|
|
2574
|
+
if (o.length) {
|
|
2575
|
+
let e = o[0], t = e.object;
|
|
2561
2576
|
d = kr(t), f = e.point;
|
|
2562
2577
|
let n = e.faceIndex * 3, r = t.geometry.index.getX(n);
|
|
2563
|
-
|
|
2578
|
+
l = t.geometry.attributes.ids.getX(r);
|
|
2564
2579
|
}
|
|
2565
|
-
if (
|
|
2566
|
-
|
|
2580
|
+
if (r) {
|
|
2581
|
+
l !== void 0 && u(d, [l]);
|
|
2567
2582
|
return;
|
|
2568
2583
|
} else if (n) {
|
|
2569
|
-
|
|
2584
|
+
l !== void 0 && (a[d]?.has(l) ?? !1 ? u(d, [l]) : (c(d, [l]), f && T(f)));
|
|
2570
2585
|
return;
|
|
2571
2586
|
}
|
|
2572
|
-
|
|
2573
|
-
},
|
|
2574
|
-
|
|
2575
|
-
},
|
|
2576
|
-
if (
|
|
2577
|
-
|
|
2587
|
+
s(d, l === void 0 ? [] : [l], !0), f && T(f);
|
|
2588
|
+
}, P = (e) => {
|
|
2589
|
+
w() || e.button !== 0 || !e.shiftKey && !e.ctrlKey || (m.current = new F(e.clientX, e.clientY), v.current = e.ctrlKey ? "remove" : "add", g.current = !1, t.current && (t.current.enabled = !1));
|
|
2590
|
+
}, ie = (e) => {
|
|
2591
|
+
if (w()) {
|
|
2592
|
+
D();
|
|
2578
2593
|
return;
|
|
2579
2594
|
}
|
|
2580
|
-
if (!
|
|
2581
|
-
let t = new F(e.clientX, e.clientY), n = Math.abs(t.x -
|
|
2582
|
-
n < 6 && r < 6 || (
|
|
2583
|
-
},
|
|
2584
|
-
if (
|
|
2585
|
-
|
|
2595
|
+
if (!m.current) return;
|
|
2596
|
+
let t = new F(e.clientX, e.clientY), n = Math.abs(t.x - m.current.x), r = Math.abs(t.y - m.current.y);
|
|
2597
|
+
n < 6 && r < 6 || (g.current ||= !0, e.preventDefault(), Cr(h, m.current, t));
|
|
2598
|
+
}, ae = (r) => {
|
|
2599
|
+
if (w()) {
|
|
2600
|
+
D();
|
|
2586
2601
|
return;
|
|
2587
2602
|
}
|
|
2588
|
-
if (!
|
|
2589
|
-
|
|
2590
|
-
let i =
|
|
2591
|
-
if (
|
|
2603
|
+
if (!m.current) return;
|
|
2604
|
+
O.current = re();
|
|
2605
|
+
let i = g.current, a = new F(r.clientX, r.clientY), o = nr(m.current, a), s = rr(m.current, a);
|
|
2606
|
+
if (m.current = null, g.current = !1, wr(h), t.current && setTimeout(() => {
|
|
2592
2607
|
t.current && (t.current.enabled = !0);
|
|
2593
2608
|
}, 100), !i) return;
|
|
2594
|
-
|
|
2595
|
-
let { ids:
|
|
2609
|
+
_.current = !0, r.preventDefault();
|
|
2610
|
+
let { ids: l, profile: d } = xr({
|
|
2596
2611
|
model: e.current,
|
|
2597
|
-
camera:
|
|
2612
|
+
camera: k,
|
|
2598
2613
|
clippingPlanes: n.getActiveClippingPlanes(),
|
|
2599
|
-
domElement:
|
|
2614
|
+
domElement: A.domElement,
|
|
2600
2615
|
rect: o,
|
|
2601
|
-
mode:
|
|
2602
|
-
}),
|
|
2603
|
-
action:
|
|
2616
|
+
mode: s
|
|
2617
|
+
}), f = Array.from(l.values()).reduce((e, t) => e + t.size, 0), p = {
|
|
2618
|
+
action: v.current,
|
|
2604
2619
|
box: d,
|
|
2605
|
-
ids:
|
|
2620
|
+
ids: f
|
|
2606
2621
|
};
|
|
2607
|
-
|
|
2622
|
+
f && (y.current = p, l.forEach((e, t) => {
|
|
2608
2623
|
let n = Array.from(e);
|
|
2609
|
-
|
|
2624
|
+
v.current === "remove" ? u(t, n) : c(t, n);
|
|
2610
2625
|
}));
|
|
2611
|
-
},
|
|
2626
|
+
}, oe = (e, t) => t ? n.getIntersection(!1, {
|
|
2612
2627
|
event: e,
|
|
2613
2628
|
filter: jr,
|
|
2614
2629
|
object: t,
|
|
@@ -2617,23 +2632,23 @@ function Mr(e, t, n) {
|
|
|
2617
2632
|
o(() => {
|
|
2618
2633
|
let e = t.current;
|
|
2619
2634
|
if (!e) return;
|
|
2620
|
-
|
|
2635
|
+
A.domElement.addEventListener("pointerdown", P), A.domElement.addEventListener("pointermove", ie), window.addEventListener("pointerup", ae), window.addEventListener("pointerup", N), A.domElement.addEventListener("contextmenu", o), A.domElement.addEventListener("pointerup", a), A.domElement.addEventListener("pointermove", ne), A.domElement.addEventListener("pointerleave", E), A.domElement.addEventListener("pointerdown", r), e.addEventListener("update", n);
|
|
2621
2636
|
function n() {
|
|
2622
|
-
typeof
|
|
2637
|
+
typeof i.current == "number" ? i.current += 1 : i.current === "start" && (i.current = 1);
|
|
2623
2638
|
}
|
|
2624
|
-
function
|
|
2625
|
-
|
|
2639
|
+
function r(e) {
|
|
2640
|
+
b.current = e.button === 0 || e.ctrlKey, i.current = "start";
|
|
2626
2641
|
}
|
|
2627
2642
|
function a() {
|
|
2628
2643
|
setTimeout(() => {
|
|
2629
|
-
|
|
2644
|
+
i.current = "end";
|
|
2630
2645
|
}, 100);
|
|
2631
2646
|
}
|
|
2632
2647
|
function o(e) {
|
|
2633
2648
|
e.ctrlKey && e.preventDefault();
|
|
2634
2649
|
}
|
|
2635
2650
|
return () => {
|
|
2636
|
-
wr(
|
|
2651
|
+
wr(h), S.current !== null && (window.clearTimeout(S.current), S.current = null), C.current = null, E(), e.removeEventListener("update", n), A.domElement.removeEventListener("pointerdown", P), A.domElement.removeEventListener("pointermove", ie), window.removeEventListener("pointerup", ae), window.removeEventListener("pointerup", N), A.domElement.removeEventListener("contextmenu", o), A.domElement.removeEventListener("pointerup", a), A.domElement.removeEventListener("pointerdown", r), A.domElement.removeEventListener("pointermove", ne), A.domElement.removeEventListener("pointerleave", E);
|
|
2637
2652
|
};
|
|
2638
2653
|
});
|
|
2639
2654
|
}
|
|
@@ -2646,7 +2661,7 @@ function Fr() {
|
|
|
2646
2661
|
if (!t.current || !(e instanceof se)) return;
|
|
2647
2662
|
let i = new g().setFromObject(t.current);
|
|
2648
2663
|
if (i.isEmpty()) return;
|
|
2649
|
-
let a = i.getCenter(new I()), o = i.getBoundingSphere(new de()), s =
|
|
2664
|
+
let a = i.getCenter(new I()), o = i.getBoundingSphere(new de()), s = re.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
2665
|
e.position.copy(a).addScaledVector(Nr, u), e.up.set(0, 1, 0), e.lookAt(a), e.updateProjectionMatrix();
|
|
2651
2666
|
let d = n.current;
|
|
2652
2667
|
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));
|
|
@@ -3217,10 +3232,40 @@ var Qi = "BMT", $i = 1, J = {
|
|
|
3217
3232
|
return this.ConvertIfcFileToBmt(e, t);
|
|
3218
3233
|
}
|
|
3219
3234
|
ConvertToBmt(e, t = {}) {
|
|
3220
|
-
let n = this.normalizeModels(e), r = this.getVisibleIdsByModel(t), i = this.getIfcSpaceIdsByModel(t.activeViewRoot), a = [], o = {};
|
|
3221
|
-
return n.forEach(([e, n],
|
|
3222
|
-
let
|
|
3223
|
-
|
|
3235
|
+
let n = this.normalizeModels(e), r = this.getVisibleIdsByModel(t), i = this.getIfcSpaceIdsByModel(t.activeViewRoot), a = [], o = {}, s = Math.max(n.length, 1);
|
|
3236
|
+
return n.forEach(([e, n], c) => {
|
|
3237
|
+
let l = (n) => {
|
|
3238
|
+
t.onProgress?.({
|
|
3239
|
+
...n,
|
|
3240
|
+
modelID: e,
|
|
3241
|
+
modelIndex: c,
|
|
3242
|
+
progress: this.clampProgress((c + this.clampProgress(n.progress)) / s)
|
|
3243
|
+
});
|
|
3244
|
+
};
|
|
3245
|
+
l({
|
|
3246
|
+
message: "Preparing model for BMT export",
|
|
3247
|
+
phase: "preparing",
|
|
3248
|
+
progress: 0
|
|
3249
|
+
}), l({
|
|
3250
|
+
message: "Filtering visible elements",
|
|
3251
|
+
phase: "filtering",
|
|
3252
|
+
progress: .05
|
|
3253
|
+
});
|
|
3254
|
+
let u = this.createSerializableModel(e, n, t, r, i), d = this.getModelFileBaseName(e, c, t);
|
|
3255
|
+
o[e] = u, l({
|
|
3256
|
+
message: "Writing BMT output",
|
|
3257
|
+
phase: "writing",
|
|
3258
|
+
progress: .15
|
|
3259
|
+
}), a.push(...this.createModelFiles(u, d, !!t.useMinVersion, (e) => {
|
|
3260
|
+
l({
|
|
3261
|
+
...e,
|
|
3262
|
+
progress: .15 + this.clampProgress(e.progress) * .84
|
|
3263
|
+
});
|
|
3264
|
+
})), l({
|
|
3265
|
+
message: "BMT model export complete",
|
|
3266
|
+
phase: "complete",
|
|
3267
|
+
progress: 1
|
|
3268
|
+
});
|
|
3224
3269
|
}), {
|
|
3225
3270
|
files: a,
|
|
3226
3271
|
models: o
|
|
@@ -3231,7 +3276,7 @@ var Qi = "BMT", $i = 1, J = {
|
|
|
3231
3276
|
}
|
|
3232
3277
|
async getIfcLoader(e) {
|
|
3233
3278
|
if (!this.ifcLoader) {
|
|
3234
|
-
let { IFCLoader: e } = await import("./IFCLoader-
|
|
3279
|
+
let { IFCLoader: e } = await import("./IFCLoader-RIJas-B5.js");
|
|
3235
3280
|
this.ifcLoader = new e();
|
|
3236
3281
|
}
|
|
3237
3282
|
return this.configureIfcLoader(this.ifcLoader, e), this.ifcLoader;
|
|
@@ -3263,44 +3308,123 @@ var Qi = "BMT", $i = 1, J = {
|
|
|
3263
3308
|
normalizeBaseName(e) {
|
|
3264
3309
|
return ((e.split(/[?#]/)[0] ?? e).split(/[\\/]/).pop() || "model").replace(/_props\.json$/i, "").replace(/\.min\.bmt$/i, "").replace(/\.(bmt|ifc)$/i, "");
|
|
3265
3310
|
}
|
|
3266
|
-
createModelFiles(e, t, n) {
|
|
3267
|
-
let
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3311
|
+
createModelFiles(e, t, n, r) {
|
|
3312
|
+
let i = n ? `${t}.min.bmt` : `${t}.bmt`, a = n ? .65 : 1, o = this.createBmtBytes(e, !n, (e) => {
|
|
3313
|
+
r?.({
|
|
3314
|
+
...e,
|
|
3315
|
+
progress: this.clampProgress(e.progress) * a
|
|
3316
|
+
});
|
|
3317
|
+
}), s = [{
|
|
3318
|
+
blob: new Blob([o], { type: ta }),
|
|
3319
|
+
bytes: o,
|
|
3320
|
+
name: i,
|
|
3271
3321
|
type: "bmt"
|
|
3272
3322
|
}];
|
|
3273
3323
|
if (n) {
|
|
3324
|
+
r?.({
|
|
3325
|
+
message: "Writing properties metadata",
|
|
3326
|
+
phase: "metadata",
|
|
3327
|
+
progress: a
|
|
3328
|
+
});
|
|
3274
3329
|
let n = this.encodePrettyJson({
|
|
3275
3330
|
props: e.props,
|
|
3276
3331
|
structure: e.structure
|
|
3277
3332
|
});
|
|
3278
|
-
|
|
3333
|
+
r?.({
|
|
3334
|
+
message: "Properties metadata encoded",
|
|
3335
|
+
phase: "metadata",
|
|
3336
|
+
progress: .95
|
|
3337
|
+
}), s.push({
|
|
3279
3338
|
blob: new Blob([n], { type: ea }),
|
|
3280
3339
|
bytes: n,
|
|
3281
3340
|
name: `${t}_props.json`,
|
|
3282
3341
|
type: "json"
|
|
3342
|
+
}), r?.({
|
|
3343
|
+
message: "Properties metadata file ready",
|
|
3344
|
+
phase: "metadata",
|
|
3345
|
+
progress: 1
|
|
3283
3346
|
});
|
|
3284
3347
|
}
|
|
3285
|
-
return
|
|
3286
|
-
}
|
|
3287
|
-
createBmtBytes(e, t) {
|
|
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();
|
|
3348
|
+
return s;
|
|
3290
3349
|
}
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
...
|
|
3295
|
-
|
|
3296
|
-
}
|
|
3297
|
-
|
|
3350
|
+
createBmtBytes(e, t, n) {
|
|
3351
|
+
let r = new na(), i = e.grids !== void 0, a = t, o = !!e.coordinationMatrix && !this.hasMeshMatrices(e), s = t ? .45 : 0, c = i ? .05 : 0, l = a ? .12 : 0, u = o ? .03 : 0, d = Math.max(.1, 1 - s - c - l - u), f = 0, p = (e) => {
|
|
3352
|
+
n?.({
|
|
3353
|
+
...e,
|
|
3354
|
+
progress: this.clampProgress(e.progress)
|
|
3355
|
+
});
|
|
3356
|
+
}, m = (e, t) => {
|
|
3357
|
+
p({
|
|
3358
|
+
...t,
|
|
3359
|
+
progress: f + this.clampProgress(t.progress) * e
|
|
3360
|
+
});
|
|
3361
|
+
}, h = (e, t, n) => {
|
|
3362
|
+
f += e, p({
|
|
3363
|
+
message: n,
|
|
3364
|
+
phase: t,
|
|
3365
|
+
progress: f
|
|
3366
|
+
});
|
|
3367
|
+
};
|
|
3368
|
+
return r.writeBytes(this.textEncoder.encode(Qi)), r.writeUint8($i), t && (this.writeProps(r, e.props, (e) => m(s, e)), h(s, "properties", "Properties written")), e.grids !== void 0 && (p({
|
|
3369
|
+
message: "Writing grids",
|
|
3370
|
+
phase: "metadata",
|
|
3371
|
+
progress: f
|
|
3372
|
+
}), this.writeJsonChunk(r, J.GRIDS, e.grids), h(c, "metadata", "Grids written")), this.writeMeshes(r, e, (e) => m(d, e)), h(d, "geometry", "Geometry written"), t && (p({
|
|
3373
|
+
message: "Writing structure",
|
|
3374
|
+
phase: "metadata",
|
|
3375
|
+
progress: f
|
|
3376
|
+
}), this.writeJsonChunk(r, J.STRUCTURE, e.structure), h(l, "metadata", "Structure written")), o && e.coordinationMatrix && (p({
|
|
3377
|
+
message: "Writing coordination matrix",
|
|
3378
|
+
phase: "metadata",
|
|
3379
|
+
progress: f
|
|
3380
|
+
}), this.writeTextChunk(r, J.MATRIX, e.coordinationMatrix), h(u, "metadata", "Coordination matrix written")), p({
|
|
3381
|
+
message: "BMT bytes ready",
|
|
3382
|
+
phase: "writing",
|
|
3383
|
+
progress: 1
|
|
3384
|
+
}), r.toUint8Array();
|
|
3385
|
+
}
|
|
3386
|
+
writeProps(e, t, n) {
|
|
3387
|
+
let r = Object.keys(t), i = r.length;
|
|
3388
|
+
n?.({
|
|
3389
|
+
loaded: 0,
|
|
3390
|
+
message: "Writing properties",
|
|
3391
|
+
phase: "properties",
|
|
3392
|
+
progress: i > 0 ? 0 : 1,
|
|
3393
|
+
total: i
|
|
3394
|
+
}), r.forEach((r, a) => {
|
|
3395
|
+
let o = t[Number(r)], s = Number(r), c = o.id === void 0 && Number.isFinite(s) ? {
|
|
3396
|
+
...o,
|
|
3397
|
+
id: s
|
|
3398
|
+
} : o;
|
|
3399
|
+
this.writeJsonChunk(e, J.PROP, c);
|
|
3400
|
+
let l = a + 1;
|
|
3401
|
+
this.shouldEmitItemProgress(l, i) && n?.({
|
|
3402
|
+
loaded: l,
|
|
3403
|
+
message: "Writing properties",
|
|
3404
|
+
phase: "properties",
|
|
3405
|
+
progress: i > 0 ? l / i : 1,
|
|
3406
|
+
total: i
|
|
3407
|
+
});
|
|
3298
3408
|
});
|
|
3299
3409
|
}
|
|
3300
|
-
writeMeshes(e, t) {
|
|
3301
|
-
let
|
|
3302
|
-
|
|
3303
|
-
|
|
3410
|
+
writeMeshes(e, t, n) {
|
|
3411
|
+
let r, i = Object.values(t.data), a = i.length;
|
|
3412
|
+
n?.({
|
|
3413
|
+
loaded: 0,
|
|
3414
|
+
message: "Writing geometry",
|
|
3415
|
+
phase: "geometry",
|
|
3416
|
+
progress: a > 0 ? 0 : 1,
|
|
3417
|
+
total: a
|
|
3418
|
+
}), i.forEach((t, i) => {
|
|
3419
|
+
t.matrix && t.matrix !== r && (this.writeTextChunk(e, J.MATRIX, t.matrix), r = t.matrix), this.writeChunk(e, t.isIfcSpace ? J.MESHSPACE : J.MESH, this.createMeshPayload(t));
|
|
3420
|
+
let o = i + 1;
|
|
3421
|
+
this.shouldEmitItemProgress(o, a) && n?.({
|
|
3422
|
+
loaded: o,
|
|
3423
|
+
message: "Writing geometry",
|
|
3424
|
+
phase: "geometry",
|
|
3425
|
+
progress: a > 0 ? o / a : 1,
|
|
3426
|
+
total: a
|
|
3427
|
+
});
|
|
3304
3428
|
});
|
|
3305
3429
|
}
|
|
3306
3430
|
createMeshPayload(e) {
|
|
@@ -3457,7 +3581,7 @@ var Qi = "BMT", $i = 1, J = {
|
|
|
3457
3581
|
let t = /* @__PURE__ */ new Map();
|
|
3458
3582
|
return (Array.isArray(e) ? e : [e]).forEach((e) => {
|
|
3459
3583
|
e.traverse((e) => {
|
|
3460
|
-
if (!(e instanceof
|
|
3584
|
+
if (!(e instanceof M) || !this.isIfcSpaceObject(e)) return;
|
|
3461
3585
|
let n = this.getObjectModelID(e);
|
|
3462
3586
|
if (n === null) return;
|
|
3463
3587
|
let r = e.geometry.getAttribute("ids");
|
|
@@ -3471,7 +3595,7 @@ var Qi = "BMT", $i = 1, J = {
|
|
|
3471
3595
|
addVisibleIdsFromObject3D(e, t) {
|
|
3472
3596
|
(Array.isArray(e) ? e : [e]).forEach((e) => {
|
|
3473
3597
|
e.traverse((e) => {
|
|
3474
|
-
if (!(e instanceof
|
|
3598
|
+
if (!(e instanceof M) || !this.isObjectVisible(e)) return;
|
|
3475
3599
|
let n = this.getObjectModelID(e);
|
|
3476
3600
|
if (n === null) return;
|
|
3477
3601
|
let r = e.geometry.getAttribute("ids");
|
|
@@ -3531,6 +3655,12 @@ var Qi = "BMT", $i = 1, J = {
|
|
|
3531
3655
|
encodePrettyJson(e) {
|
|
3532
3656
|
return this.encodeText(`${JSON.stringify(e, null, 2)}\n`);
|
|
3533
3657
|
}
|
|
3658
|
+
shouldEmitItemProgress(e, t) {
|
|
3659
|
+
return t <= 0 || e === 0 || e >= t ? !0 : e % Math.max(1, Math.floor(t / 100)) === 0;
|
|
3660
|
+
}
|
|
3661
|
+
clampProgress(e) {
|
|
3662
|
+
return Number.isFinite(e) ? Math.max(0, Math.min(1, e)) : 0;
|
|
3663
|
+
}
|
|
3534
3664
|
isRecord(e) {
|
|
3535
3665
|
return typeof e == "object" && !!e;
|
|
3536
3666
|
}
|
|
@@ -4138,7 +4268,7 @@ function Ma() {
|
|
|
4138
4268
|
//#endregion
|
|
4139
4269
|
//#region src/viewer/workers/BmtConverterWorker.ts?worker
|
|
4140
4270
|
function Na(e) {
|
|
4141
|
-
return new Worker("" + new URL("assets/BmtConverterWorker-
|
|
4271
|
+
return new Worker("" + new URL("assets/BmtConverterWorker-S83_KT6j.js", import.meta.url).href, { name: e?.name });
|
|
4142
4272
|
}
|
|
4143
4273
|
//#endregion
|
|
4144
4274
|
//#region src/viewer/workers/BmtConverterWorkerClient.ts
|
|
@@ -4256,7 +4386,7 @@ function Ja() {
|
|
|
4256
4386
|
//#endregion
|
|
4257
4387
|
//#region src/viewer/workers/IFCWorker.ts?worker
|
|
4258
4388
|
function Ya(e) {
|
|
4259
|
-
return new Worker("" + new URL("assets/IFCWorker-
|
|
4389
|
+
return new Worker("" + new URL("assets/IFCWorker-GKoow6yV.js", import.meta.url).href, { name: e?.name });
|
|
4260
4390
|
}
|
|
4261
4391
|
//#endregion
|
|
4262
4392
|
//#region src/viewer/workers/IFCWorkerClient.ts
|
|
@@ -4390,7 +4520,7 @@ var mo = new class {
|
|
|
4390
4520
|
}
|
|
4391
4521
|
async getIfcLoader(e = {}) {
|
|
4392
4522
|
if (!this.ifcLoader) {
|
|
4393
|
-
let { IFCLoader: e } = await import("./IFCLoader-
|
|
4523
|
+
let { IFCLoader: e } = await import("./IFCLoader-RIJas-B5.js");
|
|
4394
4524
|
this.ifcLoader = new e();
|
|
4395
4525
|
}
|
|
4396
4526
|
return this.ifcLoader.useIfcSpace = e.useIfcSpace ?? this.useIfcSpace, e.chunk !== void 0 && (this.ifcLoader.chunk = e.chunk), e.maxMeshBytes !== void 0 && (this.ifcLoader.maxMeshBytes = e.maxMeshBytes), e.wasmPath !== void 0 && (this.ifcLoader.wasmPath = e.wasmPath), this.ifcLoader;
|
|
@@ -4465,6 +4595,13 @@ var mo = new class {
|
|
|
4465
4595
|
resetCoordinationMatrixState() {
|
|
4466
4596
|
this.coordinationMatrix = void 0, this.ifcLoader?.resetCoordinationMatrix();
|
|
4467
4597
|
}
|
|
4598
|
+
applyRenderSettings(e, t) {
|
|
4599
|
+
return e.renderSettings = {
|
|
4600
|
+
...e.renderSettings,
|
|
4601
|
+
materialMode: t.materialMode ?? e.renderSettings?.materialMode,
|
|
4602
|
+
useDoubleSideMaterial: t.useDoubleSideMaterial ?? !1
|
|
4603
|
+
}, e;
|
|
4604
|
+
}
|
|
4468
4605
|
resetCoordinationMatrix() {
|
|
4469
4606
|
this.loadedModelCount = 0, this.resetCoordinationMatrixState();
|
|
4470
4607
|
}
|
|
@@ -4480,7 +4617,7 @@ var mo = new class {
|
|
|
4480
4617
|
else if (c === "bmt") l = t.useWorker ? await this.loadBmtModelInWorker(s, r, t, u, d, a) : await this.loadBmtModel(s, r);
|
|
4481
4618
|
else throw Error(`Unsupported model format: ${so(s)}`);
|
|
4482
4619
|
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;
|
|
4620
|
+
!this.coordinationMatrix && f && (this.coordinationMatrix = f), !l.coordinationMatrix && this.coordinationMatrix && (l.coordinationMatrix = this.coordinationMatrix), this.applyRenderSettings(l, t), l.name ??= co(s), this.nextModelID += 1, this.loadedModelCount += 1, i[u] = l;
|
|
4484
4621
|
}
|
|
4485
4622
|
return i;
|
|
4486
4623
|
}
|
|
@@ -4746,7 +4883,7 @@ function Mo(e, t) {
|
|
|
4746
4883
|
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);
|
|
4747
4884
|
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);
|
|
4748
4885
|
let u = new b(n);
|
|
4749
|
-
return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter =
|
|
4886
|
+
return u.colorSpace = ue, u.generateMipmaps = !1, u.magFilter = A, u.minFilter = A, u.needsUpdate = !0, {
|
|
4750
4887
|
aspect: c / l,
|
|
4751
4888
|
texture: u
|
|
4752
4889
|
};
|
|
@@ -4894,27 +5031,37 @@ var Bo = class {
|
|
|
4894
5031
|
}, Wo = {
|
|
4895
5032
|
alpha: !0,
|
|
4896
5033
|
antialias: !0
|
|
4897
|
-
}, Go =
|
|
4898
|
-
|
|
5034
|
+
}, Go = {
|
|
5035
|
+
alpha: !0,
|
|
5036
|
+
antialias: !1,
|
|
5037
|
+
powerPreference: "high-performance"
|
|
5038
|
+
}, Ko = {
|
|
5039
|
+
antialias: !1,
|
|
5040
|
+
powerPreference: "high-performance"
|
|
5041
|
+
}, qo = .1, Jo = .02, Yo = 1e3, Xo = 50, Zo = .08, Qo = new g(), $o = new de(), es = new I();
|
|
5042
|
+
function ts(e, t) {
|
|
5043
|
+
return Array.isArray(e) ? [Math.min(e[0], t), Math.min(e[1], t)] : typeof e == "number" ? Math.min(e, t) : t;
|
|
5044
|
+
}
|
|
5045
|
+
function ns() {
|
|
4899
5046
|
let e = navigator, t = navigator.userAgent.toLowerCase(), n = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, r = window.matchMedia?.("(pointer: coarse)").matches ?? !1;
|
|
4900
5047
|
return e.userAgentData?.mobile || n || /android|iphone|ipad|ipod|mobile|tablet/.test(t) || navigator.maxTouchPoints > 1 && r ? "mobile" : "pc";
|
|
4901
5048
|
}
|
|
4902
|
-
function
|
|
4903
|
-
let t =
|
|
4904
|
-
return t ? Math.max(t.radius *
|
|
5049
|
+
function rs(e) {
|
|
5050
|
+
let t = is(e);
|
|
5051
|
+
return t ? Math.max(t.radius * Jo, qo) : qo;
|
|
4905
5052
|
}
|
|
4906
|
-
function
|
|
4907
|
-
if (!e || (
|
|
4908
|
-
let t =
|
|
5053
|
+
function is(e) {
|
|
5054
|
+
if (!e || (Qo.setFromObject(e), Qo.isEmpty())) return null;
|
|
5055
|
+
let t = Qo.getBoundingSphere($o);
|
|
4909
5056
|
return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
|
|
4910
5057
|
}
|
|
4911
|
-
function
|
|
4912
|
-
let n =
|
|
5058
|
+
function as(e, t) {
|
|
5059
|
+
let n = is(t);
|
|
4913
5060
|
if (!n) return;
|
|
4914
|
-
let r = Math.max(
|
|
5061
|
+
let r = Math.max(Yo, n.radius * Xo, e.near + 1);
|
|
4915
5062
|
Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
|
|
4916
5063
|
}
|
|
4917
|
-
function
|
|
5064
|
+
function os(e, t, n, r, i) {
|
|
4918
5065
|
let a = n.elementIndex.get(i);
|
|
4919
5066
|
a && a.forEach((n) => {
|
|
4920
5067
|
let { record: i, vertexRanges: a } = n;
|
|
@@ -4926,166 +5073,193 @@ function rs(e, t, n, r, i) {
|
|
|
4926
5073
|
}));
|
|
4927
5074
|
});
|
|
4928
5075
|
}
|
|
4929
|
-
function
|
|
5076
|
+
function ss(e, t) {
|
|
4930
5077
|
let n = new g(), r = new I();
|
|
4931
5078
|
return Object.entries(e).forEach(([e, i]) => {
|
|
4932
5079
|
let a = Number(e);
|
|
4933
5080
|
i.forEach((e) => {
|
|
4934
|
-
|
|
5081
|
+
os(n, r, t, a, e);
|
|
4935
5082
|
});
|
|
4936
5083
|
}), n.isEmpty() ? null : n;
|
|
4937
5084
|
}
|
|
4938
|
-
function
|
|
4939
|
-
let t = e.getSize(
|
|
4940
|
-
return Number.isFinite(n) && n > 0 ? n *
|
|
5085
|
+
function cs(e) {
|
|
5086
|
+
let t = e.getSize(es), n = Math.max(t.x, t.y, t.z);
|
|
5087
|
+
return Number.isFinite(n) && n > 0 ? n * Zo : qo;
|
|
4941
5088
|
}
|
|
4942
|
-
function
|
|
4943
|
-
let
|
|
4944
|
-
let e = Object.keys(
|
|
5089
|
+
function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materialMode: a, modelRef: s, modelsData: u, onReady: d, publicApi: f, setSceneApi: g }) {
|
|
5090
|
+
let _ = p((e) => e.camera), v = p((e) => e.gl), y = Mt(s), b = Ut(y), { colorPaletteTexture: x, colorUtils: S } = Ge(y), C = Bn(s), w = vn(s, n, C), T = Nn(s, n, C), E = c(() => new ra(), []), D = b.buildIndex, ee = y.resetIndex, te = S.applyStoredColors, ne = Fr(), O = l(null), k = l(!1), A = z((e) => e.showStats), re = c(() => {
|
|
5091
|
+
let e = Object.keys(u).sort((e, t) => Number(e) - Number(t));
|
|
4945
5092
|
for (let t of e) {
|
|
4946
|
-
let e = St(
|
|
5093
|
+
let e = St(u[Number(t)]);
|
|
4947
5094
|
if (e) return e;
|
|
4948
5095
|
}
|
|
4949
5096
|
return null;
|
|
4950
|
-
}, [
|
|
4951
|
-
n.current && (n.current.minDistance =
|
|
4952
|
-
}, [n,
|
|
5097
|
+
}, [u]), j = c(() => bt(re ?? void 0), [re]), M = c(() => Object.entries(u).map(([e, t]) => [Number(e), t]), [u]), N = i(() => {
|
|
5098
|
+
n.current && (n.current.minDistance = rs(s.current));
|
|
5099
|
+
}, [n, s]), P = i((e) => {
|
|
5100
|
+
let t = n.current;
|
|
5101
|
+
t && (t.cancel(), t.setOrbitPoint(e.x, e.y, e.z));
|
|
5102
|
+
}, [n]), ie = i((e) => {
|
|
5103
|
+
O.current = e.clone(), P(e);
|
|
5104
|
+
}, [P]), ae = i(() => {
|
|
5105
|
+
O.current = null, ne(s, n, r);
|
|
5106
|
+
}, [
|
|
5107
|
+
n,
|
|
5108
|
+
ne,
|
|
5109
|
+
r,
|
|
5110
|
+
s
|
|
5111
|
+
]), ce = i((e, t = !1) => {
|
|
4953
5112
|
let r = n.current;
|
|
4954
5113
|
if (!r) return;
|
|
4955
|
-
let i =
|
|
5114
|
+
let i = ss(e, y.buildIndex());
|
|
4956
5115
|
if (!i) return;
|
|
4957
5116
|
let a = i.getCenter(new I());
|
|
4958
|
-
if (r.cancel(), t) {
|
|
4959
|
-
let e =
|
|
5117
|
+
if (O.current = a.clone(), r.cancel(), t) {
|
|
5118
|
+
let e = cs(i);
|
|
4960
5119
|
r.fitToBox(i, !0, {
|
|
4961
5120
|
paddingBottom: e,
|
|
4962
5121
|
paddingLeft: e,
|
|
4963
5122
|
paddingRight: e,
|
|
4964
5123
|
paddingTop: e
|
|
5124
|
+
}).then(() => {
|
|
5125
|
+
let e = O.current;
|
|
5126
|
+
e && r.setOrbitPoint(e.x, e.y, e.z);
|
|
4965
5127
|
});
|
|
4966
5128
|
return;
|
|
4967
5129
|
}
|
|
4968
|
-
|
|
4969
|
-
}, [
|
|
5130
|
+
P(a);
|
|
5131
|
+
}, [
|
|
5132
|
+
P,
|
|
5133
|
+
n,
|
|
5134
|
+
y
|
|
5135
|
+
]), le = c(() => {
|
|
4970
5136
|
let e = (e) => ({
|
|
4971
5137
|
...e,
|
|
4972
|
-
activeViewRoot:
|
|
5138
|
+
activeViewRoot: s.current
|
|
4973
5139
|
});
|
|
4974
5140
|
return {
|
|
4975
|
-
convertIfcFileToBmt: (e, t) =>
|
|
4976
|
-
convertToBmt: (t) =>
|
|
5141
|
+
convertIfcFileToBmt: (e, t) => E.ConvertIfcFileToBmt(e, t),
|
|
5142
|
+
convertToBmt: (t) => E.ConvertToBmt(u, e(t))
|
|
4977
5143
|
};
|
|
4978
5144
|
}, [
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
5145
|
+
E,
|
|
5146
|
+
s,
|
|
5147
|
+
u
|
|
4982
5148
|
]);
|
|
4983
|
-
return Mr(
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
5149
|
+
return Mr(s, n, C, ie), Fn(), o(() => {
|
|
5150
|
+
let e = v.domElement, t = (e) => {
|
|
5151
|
+
let t = O.current;
|
|
5152
|
+
t && e.button === 0 && (e.ctrlKey || e.metaKey || e.shiftKey || P(t));
|
|
5153
|
+
};
|
|
5154
|
+
return e.addEventListener("pointerdown", t, !0), () => {
|
|
5155
|
+
e.removeEventListener("pointerdown", t, !0);
|
|
5156
|
+
};
|
|
5157
|
+
}, [P, v]), o(() => (C.setClippingSource(w), () => {
|
|
5158
|
+
C.setClippingSource(null);
|
|
5159
|
+
}), [C, w]), o(() => (t.current = _, () => {
|
|
5160
|
+
t.current === _ && (t.current = null);
|
|
5161
|
+
}), [_, t]), o(() => {
|
|
5162
|
+
if (!s.current) return;
|
|
4989
5163
|
let t = requestAnimationFrame(() => {
|
|
4990
|
-
|
|
5164
|
+
s.current?.updateMatrixWorld(!0), (_ instanceof se || _ instanceof oe) && as(_, s.current), N(), ee(), D(), te(), w.syncWithModel(), T.syncWithModel(), e && ae();
|
|
4991
5165
|
});
|
|
4992
5166
|
return () => cancelAnimationFrame(t);
|
|
4993
5167
|
}, [
|
|
4994
|
-
|
|
5168
|
+
te,
|
|
4995
5169
|
e,
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
5170
|
+
D,
|
|
5171
|
+
_,
|
|
5172
|
+
w,
|
|
4999
5173
|
n,
|
|
5000
|
-
|
|
5001
|
-
|
|
5174
|
+
T,
|
|
5175
|
+
ae,
|
|
5002
5176
|
r,
|
|
5003
|
-
a,
|
|
5004
5177
|
s,
|
|
5005
|
-
|
|
5006
|
-
|
|
5178
|
+
u,
|
|
5179
|
+
ee,
|
|
5180
|
+
N
|
|
5007
5181
|
]), o(() => {
|
|
5008
5182
|
let e = () => {
|
|
5009
|
-
!
|
|
5183
|
+
!w.getActive() || !w.getEdgesActive() || w.updateEdges();
|
|
5010
5184
|
}, t = (t) => {
|
|
5011
5185
|
t(), e();
|
|
5012
5186
|
};
|
|
5013
|
-
return
|
|
5187
|
+
return g({
|
|
5014
5188
|
camera: {
|
|
5015
|
-
fitCamera:
|
|
5016
|
-
getIntersection:
|
|
5189
|
+
fitCamera: ae,
|
|
5190
|
+
getIntersection: C.getIntersection
|
|
5017
5191
|
},
|
|
5018
5192
|
clipping: {
|
|
5019
|
-
createClippingRectangle:
|
|
5020
|
-
createPlane:
|
|
5021
|
-
deleteAllPlanes:
|
|
5022
|
-
getActive:
|
|
5023
|
-
getEdgesActive:
|
|
5024
|
-
getHelpersActive:
|
|
5025
|
-
getPlanes:
|
|
5026
|
-
setActive:
|
|
5027
|
-
setEdgesActive:
|
|
5028
|
-
setHelpersActive:
|
|
5029
|
-
toggle:
|
|
5030
|
-
updateEdges:
|
|
5031
|
-
updateMaterials:
|
|
5193
|
+
createClippingRectangle: w.createClippingRectangle,
|
|
5194
|
+
createPlane: w.createPlane,
|
|
5195
|
+
deleteAllPlanes: w.deleteAllPlanes,
|
|
5196
|
+
getActive: w.getActive,
|
|
5197
|
+
getEdgesActive: w.getEdgesActive,
|
|
5198
|
+
getHelpersActive: w.getHelpersActive,
|
|
5199
|
+
getPlanes: w.getPlanes,
|
|
5200
|
+
setActive: w.setActive,
|
|
5201
|
+
setEdgesActive: w.setEdgesActive,
|
|
5202
|
+
setHelpersActive: w.setHelpersActive,
|
|
5203
|
+
toggle: w.toggle,
|
|
5204
|
+
updateEdges: w.updateEdges,
|
|
5205
|
+
updateMaterials: w.updateMaterials
|
|
5032
5206
|
},
|
|
5033
5207
|
colors: {
|
|
5034
|
-
clearAllColors:
|
|
5035
|
-
clearColor:
|
|
5036
|
-
clearModelColors:
|
|
5037
|
-
rebuildByColors:
|
|
5038
|
-
rebuildModelByColors:
|
|
5039
|
-
setColor:
|
|
5208
|
+
clearAllColors: S.clearAllColors,
|
|
5209
|
+
clearColor: S.clearColor,
|
|
5210
|
+
clearModelColors: S.clearModelColors,
|
|
5211
|
+
rebuildByColors: S.rebuildByColors,
|
|
5212
|
+
rebuildModelByColors: S.rebuildModelByColors,
|
|
5213
|
+
setColor: S.setColor
|
|
5040
5214
|
},
|
|
5041
|
-
converter:
|
|
5215
|
+
converter: le,
|
|
5042
5216
|
dimensions: {
|
|
5043
|
-
cancelDrawing:
|
|
5044
|
-
changeAxes:
|
|
5045
|
-
delete:
|
|
5046
|
-
deleteAll:
|
|
5047
|
-
getActive:
|
|
5048
|
-
getDimensions:
|
|
5049
|
-
getSnapDistance:
|
|
5050
|
-
getUnit:
|
|
5051
|
-
setActive:
|
|
5052
|
-
setColor:
|
|
5053
|
-
setEndpointScaleFactor:
|
|
5054
|
-
setSnapDistance:
|
|
5055
|
-
setUnit:
|
|
5056
|
-
setWidth:
|
|
5057
|
-
toggle:
|
|
5217
|
+
cancelDrawing: T.cancelDrawing,
|
|
5218
|
+
changeAxes: T.changeAxes,
|
|
5219
|
+
delete: T.delete,
|
|
5220
|
+
deleteAll: T.deleteAll,
|
|
5221
|
+
getActive: T.getActive,
|
|
5222
|
+
getDimensions: T.getDimensions,
|
|
5223
|
+
getSnapDistance: T.getSnapDistance,
|
|
5224
|
+
getUnit: T.getUnit,
|
|
5225
|
+
setActive: T.setActive,
|
|
5226
|
+
setColor: T.setColor,
|
|
5227
|
+
setEndpointScaleFactor: T.setEndpointScaleFactor,
|
|
5228
|
+
setSnapDistance: T.setSnapDistance,
|
|
5229
|
+
setUnit: T.setUnit,
|
|
5230
|
+
setWidth: T.setWidth,
|
|
5231
|
+
toggle: T.toggle
|
|
5058
5232
|
},
|
|
5059
5233
|
geometryUtils: {
|
|
5060
|
-
getAllIds:
|
|
5061
|
-
getIfcSpacesVisibility:
|
|
5062
|
-
hideByIds: (e) => t(() =>
|
|
5063
|
-
hideSelected: () => t(
|
|
5064
|
-
isolateByIds: (e) => t(() =>
|
|
5065
|
-
isolateSelected: () => t(
|
|
5066
|
-
resetIsolation: () => t(
|
|
5067
|
-
setIfcSpacesVisibility: (e) => t(() =>
|
|
5068
|
-
showAll: () => t(
|
|
5069
|
-
showByIds: (e) => t(() =>
|
|
5070
|
-
toggleIIfcSpacesVisibility: () => t(
|
|
5234
|
+
getAllIds: b.getAllIds,
|
|
5235
|
+
getIfcSpacesVisibility: b.getIfcSpacesVisibility,
|
|
5236
|
+
hideByIds: (e) => t(() => b.hideByIds(e)),
|
|
5237
|
+
hideSelected: () => t(b.hideSelected),
|
|
5238
|
+
isolateByIds: (e) => t(() => b.isolateByIds(e)),
|
|
5239
|
+
isolateSelected: () => t(b.isolateSelected),
|
|
5240
|
+
resetIsolation: () => t(b.resetIsolation),
|
|
5241
|
+
setIfcSpacesVisibility: (e) => t(() => b.setIfcSpacesVisibility(e)),
|
|
5242
|
+
showAll: () => t(b.showAll),
|
|
5243
|
+
showByIds: (e) => t(() => b.showByIds(e)),
|
|
5244
|
+
toggleIIfcSpacesVisibility: () => t(b.toggleIIfcSpacesVisibility)
|
|
5071
5245
|
},
|
|
5072
|
-
selector: { setTargetToSelection:
|
|
5073
|
-
}), k.current || (k.current = !0,
|
|
5246
|
+
selector: { setTargetToSelection: ce }
|
|
5247
|
+
}), k.current || (k.current = !0, d?.(f)), () => g(null);
|
|
5074
5248
|
}, [
|
|
5249
|
+
w,
|
|
5250
|
+
C,
|
|
5075
5251
|
S,
|
|
5076
|
-
x,
|
|
5077
|
-
b,
|
|
5078
5252
|
n,
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5253
|
+
le,
|
|
5254
|
+
T,
|
|
5255
|
+
ae,
|
|
5256
|
+
b,
|
|
5083
5257
|
r,
|
|
5084
|
-
|
|
5085
|
-
u,
|
|
5258
|
+
s,
|
|
5086
5259
|
d,
|
|
5087
5260
|
f,
|
|
5088
|
-
|
|
5261
|
+
g,
|
|
5262
|
+
ce
|
|
5089
5263
|
]), /* @__PURE__ */ R(Ce, { children: [
|
|
5090
5264
|
/* @__PURE__ */ L("ambientLight", {
|
|
5091
5265
|
intensity: 1.2,
|
|
@@ -5103,11 +5277,12 @@ function os({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelR
|
|
|
5103
5277
|
}),
|
|
5104
5278
|
A && /* @__PURE__ */ L(h, {}),
|
|
5105
5279
|
/* @__PURE__ */ L("group", {
|
|
5106
|
-
ref:
|
|
5280
|
+
ref: s,
|
|
5107
5281
|
children: M.map(([e, t]) => /* @__PURE__ */ L(wt, {
|
|
5108
|
-
colorPaletteTexture:
|
|
5282
|
+
colorPaletteTexture: x,
|
|
5109
5283
|
coordinationMatrix: j,
|
|
5110
5284
|
data: t,
|
|
5285
|
+
materialMode: a,
|
|
5111
5286
|
modelID: e
|
|
5112
5287
|
}, e))
|
|
5113
5288
|
}),
|
|
@@ -5115,45 +5290,45 @@ function os({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, modelR
|
|
|
5115
5290
|
dollyToCursor: !0,
|
|
5116
5291
|
draggingSmoothTime: .04,
|
|
5117
5292
|
infinityDolly: !0,
|
|
5118
|
-
minDistance:
|
|
5293
|
+
minDistance: qo,
|
|
5119
5294
|
ref: n,
|
|
5120
5295
|
smoothTime: .12
|
|
5121
5296
|
})
|
|
5122
5297
|
] });
|
|
5123
5298
|
}
|
|
5124
|
-
function
|
|
5299
|
+
function us({ autoFitCamera: e = !0, camera: t = {
|
|
5125
5300
|
position: [
|
|
5126
5301
|
10,
|
|
5127
5302
|
10,
|
|
5128
5303
|
10
|
|
5129
5304
|
],
|
|
5130
5305
|
fov: 50
|
|
5131
|
-
}, dpr: n = window.devicePixelRatio, modelUrls: r, modelSources: i, modelsData: a,
|
|
5132
|
-
let
|
|
5306
|
+
}, dpr: n = window.devicePixelRatio, modelUrls: r, modelSources: i, modelsData: a, materialMode: s, onReady: c, performanceMode: f = !1, publicApi: p, setSceneApi: m, showNavCube: h, showStats: g }) {
|
|
5307
|
+
let _ = l(null), v = l(null), y = l(null), b = l(null), [x, S] = u(), C = Ee(), w = z((e) => e.setModelNames), T = z((e) => e.setModelProps), E = z((e) => e.setModelStructure), D = z((e) => e.setShowNavCube), ee = z((e) => e.setShowStats), te = z((e) => e.setUserDevice), ne = z((e) => e.showNavCube), O = a ?? x, k = f ? ts(n, 1) : n, A = s ?? (f ? "performance" : void 0);
|
|
5133
5308
|
return o(() => {
|
|
5134
|
-
|
|
5135
|
-
}, [
|
|
5136
|
-
|
|
5137
|
-
}, [
|
|
5138
|
-
|
|
5139
|
-
}, [
|
|
5309
|
+
te(ns());
|
|
5310
|
+
}, [te]), o(() => {
|
|
5311
|
+
ee(!!g);
|
|
5312
|
+
}, [ee, g]), o(() => {
|
|
5313
|
+
h !== void 0 && D(h);
|
|
5314
|
+
}, [D, h]), o(() => {
|
|
5140
5315
|
let e = {}, t = {}, n = {};
|
|
5141
|
-
|
|
5316
|
+
O && Object.entries(O).forEach(([r, i]) => {
|
|
5142
5317
|
let a = Number(r);
|
|
5143
5318
|
i.name !== void 0 && (e[a] = i.name), i.props !== void 0 && (t[a] = i.props), i.structure !== void 0 && (n[a] = i.structure);
|
|
5144
|
-
}),
|
|
5319
|
+
}), w(e), T(t), E(n);
|
|
5145
5320
|
}, [
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5321
|
+
O,
|
|
5322
|
+
w,
|
|
5323
|
+
T,
|
|
5324
|
+
E
|
|
5150
5325
|
]), o(() => {
|
|
5151
5326
|
if (a) return;
|
|
5152
5327
|
let e = i ?? r;
|
|
5153
5328
|
if (!e?.length) return;
|
|
5154
5329
|
let t = !0;
|
|
5155
5330
|
return mo.loadModel(e).then((e) => {
|
|
5156
|
-
t &&
|
|
5331
|
+
t && S(e);
|
|
5157
5332
|
}), () => {
|
|
5158
5333
|
t = !1;
|
|
5159
5334
|
};
|
|
@@ -5161,43 +5336,45 @@ function ss({ autoFitCamera: e = !0, camera: t = {
|
|
|
5161
5336
|
a,
|
|
5162
5337
|
i,
|
|
5163
5338
|
r
|
|
5164
|
-
]),
|
|
5339
|
+
]), O ? /* @__PURE__ */ R("div", {
|
|
5165
5340
|
style: Ho,
|
|
5166
5341
|
children: [/* @__PURE__ */ L(d, {
|
|
5167
5342
|
camera: t,
|
|
5168
|
-
dpr:
|
|
5343
|
+
dpr: k,
|
|
5344
|
+
gl: f ? Ko : void 0,
|
|
5169
5345
|
children: /* @__PURE__ */ L(Ir, {
|
|
5170
|
-
store:
|
|
5171
|
-
children: /* @__PURE__ */ L(
|
|
5346
|
+
store: C,
|
|
5347
|
+
children: /* @__PURE__ */ L(ls, {
|
|
5172
5348
|
autoFitCamera: e,
|
|
5173
|
-
cameraRef:
|
|
5174
|
-
controlRef:
|
|
5175
|
-
lightRef:
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5349
|
+
cameraRef: _,
|
|
5350
|
+
controlRef: v,
|
|
5351
|
+
lightRef: b,
|
|
5352
|
+
materialMode: A,
|
|
5353
|
+
modelRef: y,
|
|
5354
|
+
modelsData: O,
|
|
5355
|
+
onReady: c,
|
|
5356
|
+
publicApi: p,
|
|
5357
|
+
setSceneApi: m
|
|
5181
5358
|
})
|
|
5182
5359
|
})
|
|
5183
|
-
}),
|
|
5360
|
+
}), ne && /* @__PURE__ */ L("div", {
|
|
5184
5361
|
style: Vo,
|
|
5185
5362
|
children: /* @__PURE__ */ L(d, {
|
|
5186
5363
|
camera: Uo,
|
|
5187
|
-
dpr:
|
|
5188
|
-
gl: Wo,
|
|
5364
|
+
dpr: k,
|
|
5365
|
+
gl: f ? Go : Wo,
|
|
5189
5366
|
orthographic: !0,
|
|
5190
5367
|
children: /* @__PURE__ */ L(zo, {
|
|
5191
5368
|
active: !0,
|
|
5192
|
-
cameraRef:
|
|
5193
|
-
controlRef:
|
|
5194
|
-
modelRef:
|
|
5369
|
+
cameraRef: _,
|
|
5370
|
+
controlRef: v,
|
|
5371
|
+
modelRef: y
|
|
5195
5372
|
})
|
|
5196
5373
|
})
|
|
5197
5374
|
})]
|
|
5198
5375
|
}) : /* @__PURE__ */ L(Ce, {});
|
|
5199
5376
|
}
|
|
5200
|
-
var
|
|
5377
|
+
var ds = n(function(e, t) {
|
|
5201
5378
|
let [n] = u(Ae), r = l(!1), a = l(!1), d = c(() => new Bo(), []), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
|
|
5202
5379
|
d.set(e);
|
|
5203
5380
|
}, [d]), g = c(() => ba(n, d.get), [d, n]);
|
|
@@ -5217,13 +5394,13 @@ var cs = n(function(e, t) {
|
|
|
5217
5394
|
});
|
|
5218
5395
|
}, [p, n]), /* @__PURE__ */ L(Ir, {
|
|
5219
5396
|
store: n,
|
|
5220
|
-
children: /* @__PURE__ */ L(
|
|
5397
|
+
children: /* @__PURE__ */ L(us, {
|
|
5221
5398
|
...e,
|
|
5222
5399
|
publicApi: g,
|
|
5223
5400
|
setSceneApi: h
|
|
5224
5401
|
})
|
|
5225
5402
|
});
|
|
5226
5403
|
});
|
|
5227
|
-
|
|
5404
|
+
ds.displayName = "Viewer";
|
|
5228
5405
|
//#endregion
|
|
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,
|
|
5406
|
+
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, ds 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 };
|