bimatter-viewer-react 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -6
- package/lib/{IFCLoader-RIJas-B5.js → IFCLoader-Cjkb3xMA.js} +1 -1
- package/lib/api/ViewerApi.d.ts +3 -1
- package/lib/assets/{BmtConverterWorker-S83_KT6j.js → BmtConverterWorker-BHhPlty_.js} +1 -1
- package/lib/assets/{IFCWorker-GKoow6yV.js → IFCWorker-DipGoUKy.js} +1 -1
- package/lib/index.js +51 -38
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -704,7 +704,7 @@ var wt = r(Ct);
|
|
|
704
704
|
function Tt() {
|
|
705
705
|
return {
|
|
706
706
|
elementIndex: /* @__PURE__ */ new Map(),
|
|
707
|
-
ifcSpacesVisible: !
|
|
707
|
+
ifcSpacesVisible: !1,
|
|
708
708
|
indexedModel: null,
|
|
709
709
|
isolatedIdsByModel: null,
|
|
710
710
|
isolatedIds: null,
|
|
@@ -756,30 +756,30 @@ function Mt(e) {
|
|
|
756
756
|
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
757
757
|
return n.traverse((e) => {
|
|
758
758
|
if (!(e instanceof M)) return;
|
|
759
|
-
let t = e, n = t.geometry,
|
|
760
|
-
if (!
|
|
761
|
-
let
|
|
759
|
+
let t = e, n = t.geometry, o = n.index, s = n.attributes.ids;
|
|
760
|
+
if (!o || !s) return;
|
|
761
|
+
let c = At(t), l = jt(t), u = Et(o.array), d = {
|
|
762
762
|
hiddenIds: /* @__PURE__ */ new Set(),
|
|
763
763
|
initialVisible: t.visible,
|
|
764
|
-
isIfcSpace:
|
|
764
|
+
isIfcSpace: l,
|
|
765
765
|
mesh: t,
|
|
766
|
-
modelID:
|
|
766
|
+
modelID: c,
|
|
767
767
|
originalBoundsTree: n.boundsTree ?? null,
|
|
768
|
-
originalIndex:
|
|
768
|
+
originalIndex: u,
|
|
769
769
|
visibleStateKey: "",
|
|
770
770
|
triangleRanges: []
|
|
771
|
-
},
|
|
772
|
-
for (let e = 0; e <
|
|
773
|
-
let t =
|
|
774
|
-
|
|
771
|
+
}, f = /* @__PURE__ */ new Map(), p = null, m = 0, h = u.length / 3;
|
|
772
|
+
for (let e = 0; e < h; e++) {
|
|
773
|
+
let t = s.getX(u[e * 3]);
|
|
774
|
+
p === null ? (p = t, m = e) : t !== p && (kt(p, m, e - m, d, f, i), p = t, m = e);
|
|
775
775
|
}
|
|
776
|
-
|
|
777
|
-
let
|
|
778
|
-
for (let e = 0; e <
|
|
779
|
-
let t =
|
|
780
|
-
|
|
776
|
+
p !== null && kt(p, m, h - m, d, f, i);
|
|
777
|
+
let g = null, _ = 0;
|
|
778
|
+
for (let e = 0; e < s.count; e++) {
|
|
779
|
+
let t = s.getX(e);
|
|
780
|
+
g === null ? (g = t, _ = e) : t !== g && (Ot(g, _, e - _, d, f, i), g = t, _ = e);
|
|
781
781
|
}
|
|
782
|
-
|
|
782
|
+
g !== null && Ot(g, _, s.count - _, d, f, i), a.add(d), l && !r.ifcSpacesVisible && (t.visible = !1);
|
|
783
783
|
}), t.current = {
|
|
784
784
|
elementIndex: i,
|
|
785
785
|
ifcSpacesVisible: r.ifcSpacesVisible,
|
|
@@ -3276,7 +3276,7 @@ var Qi = "BMT", $i = 1, J = {
|
|
|
3276
3276
|
}
|
|
3277
3277
|
async getIfcLoader(e) {
|
|
3278
3278
|
if (!this.ifcLoader) {
|
|
3279
|
-
let { IFCLoader: e } = await import("./IFCLoader-
|
|
3279
|
+
let { IFCLoader: e } = await import("./IFCLoader-Cjkb3xMA.js");
|
|
3280
3280
|
this.ifcLoader = new e();
|
|
3281
3281
|
}
|
|
3282
3282
|
return this.configureIfcLoader(this.ifcLoader, e), this.ifcLoader;
|
|
@@ -3923,7 +3923,9 @@ function ba(e, t) {
|
|
|
3923
3923
|
},
|
|
3924
3924
|
geometryUtils: {
|
|
3925
3925
|
getAllIds: () => t()?.geometryUtils.getAllIds() ?? [],
|
|
3926
|
-
getIfcSpacesVisibility: () => t()?.geometryUtils.getIfcSpacesVisibility() ?? !
|
|
3926
|
+
getIfcSpacesVisibility: () => t()?.geometryUtils.getIfcSpacesVisibility() ?? !1,
|
|
3927
|
+
getModelGeometry: (e) => t()?.geometryUtils.getModelGeometry(e) ?? null,
|
|
3928
|
+
getModelsGeometry: () => t()?.geometryUtils.getModelsGeometry() ?? [],
|
|
3927
3929
|
hideByIds: (e) => {
|
|
3928
3930
|
t()?.geometryUtils.hideByIds(e);
|
|
3929
3931
|
},
|
|
@@ -4268,7 +4270,7 @@ function Ma() {
|
|
|
4268
4270
|
//#endregion
|
|
4269
4271
|
//#region src/viewer/workers/BmtConverterWorker.ts?worker
|
|
4270
4272
|
function Na(e) {
|
|
4271
|
-
return new Worker("" + new URL("assets/BmtConverterWorker-
|
|
4273
|
+
return new Worker("" + new URL("assets/BmtConverterWorker-BHhPlty_.js", import.meta.url).href, { name: e?.name });
|
|
4272
4274
|
}
|
|
4273
4275
|
//#endregion
|
|
4274
4276
|
//#region src/viewer/workers/BmtConverterWorkerClient.ts
|
|
@@ -4386,7 +4388,7 @@ function Ja() {
|
|
|
4386
4388
|
//#endregion
|
|
4387
4389
|
//#region src/viewer/workers/IFCWorker.ts?worker
|
|
4388
4390
|
function Ya(e) {
|
|
4389
|
-
return new Worker("" + new URL("assets/IFCWorker-
|
|
4391
|
+
return new Worker("" + new URL("assets/IFCWorker-DipGoUKy.js", import.meta.url).href, { name: e?.name });
|
|
4390
4392
|
}
|
|
4391
4393
|
//#endregion
|
|
4392
4394
|
//#region src/viewer/workers/IFCWorkerClient.ts
|
|
@@ -4507,7 +4509,7 @@ function po(e) {
|
|
|
4507
4509
|
}
|
|
4508
4510
|
var mo = new class {
|
|
4509
4511
|
coordinationMatrix;
|
|
4510
|
-
useIfcSpace = !
|
|
4512
|
+
useIfcSpace = !0;
|
|
4511
4513
|
bmtLoader = null;
|
|
4512
4514
|
ifcLoader = null;
|
|
4513
4515
|
loadedModelCount = 0;
|
|
@@ -4520,7 +4522,7 @@ var mo = new class {
|
|
|
4520
4522
|
}
|
|
4521
4523
|
async getIfcLoader(e = {}) {
|
|
4522
4524
|
if (!this.ifcLoader) {
|
|
4523
|
-
let { IFCLoader: e } = await import("./IFCLoader-
|
|
4525
|
+
let { IFCLoader: e } = await import("./IFCLoader-Cjkb3xMA.js");
|
|
4524
4526
|
this.ifcLoader = new e();
|
|
4525
4527
|
}
|
|
4526
4528
|
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;
|
|
@@ -5055,13 +5057,22 @@ function is(e) {
|
|
|
5055
5057
|
let t = Qo.getBoundingSphere($o);
|
|
5056
5058
|
return !Number.isFinite(t.radius) || t.radius <= 0 ? null : t;
|
|
5057
5059
|
}
|
|
5058
|
-
function as(e
|
|
5060
|
+
function as(e) {
|
|
5061
|
+
return e.type === "Group" && typeof e.userData.modelID == "number";
|
|
5062
|
+
}
|
|
5063
|
+
function os(e) {
|
|
5064
|
+
return e?.children.filter(as) ?? [];
|
|
5065
|
+
}
|
|
5066
|
+
function ss(e, t) {
|
|
5067
|
+
return os(e).find((e) => e.userData.modelID === t) ?? null;
|
|
5068
|
+
}
|
|
5069
|
+
function cs(e, t) {
|
|
5059
5070
|
let n = is(t);
|
|
5060
5071
|
if (!n) return;
|
|
5061
5072
|
let r = Math.max(Yo, n.radius * Xo, e.near + 1);
|
|
5062
5073
|
Math.abs(e.far - r) < 1 || (e.far = r, e.updateProjectionMatrix());
|
|
5063
5074
|
}
|
|
5064
|
-
function
|
|
5075
|
+
function ls(e, t, n, r, i) {
|
|
5065
5076
|
let a = n.elementIndex.get(i);
|
|
5066
5077
|
a && a.forEach((n) => {
|
|
5067
5078
|
let { record: i, vertexRanges: a } = n;
|
|
@@ -5073,20 +5084,20 @@ function os(e, t, n, r, i) {
|
|
|
5073
5084
|
}));
|
|
5074
5085
|
});
|
|
5075
5086
|
}
|
|
5076
|
-
function
|
|
5087
|
+
function us(e, t) {
|
|
5077
5088
|
let n = new g(), r = new I();
|
|
5078
5089
|
return Object.entries(e).forEach(([e, i]) => {
|
|
5079
5090
|
let a = Number(e);
|
|
5080
5091
|
i.forEach((e) => {
|
|
5081
|
-
|
|
5092
|
+
ls(n, r, t, a, e);
|
|
5082
5093
|
});
|
|
5083
5094
|
}), n.isEmpty() ? null : n;
|
|
5084
5095
|
}
|
|
5085
|
-
function
|
|
5096
|
+
function ds(e) {
|
|
5086
5097
|
let t = e.getSize(es), n = Math.max(t.x, t.y, t.z);
|
|
5087
5098
|
return Number.isFinite(n) && n > 0 ? n * Zo : qo;
|
|
5088
5099
|
}
|
|
5089
|
-
function
|
|
5100
|
+
function fs({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materialMode: a, modelRef: s, modelsData: u, onReady: d, publicApi: f, setSceneApi: g }) {
|
|
5090
5101
|
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
5102
|
let e = Object.keys(u).sort((e, t) => Number(e) - Number(t));
|
|
5092
5103
|
for (let t of e) {
|
|
@@ -5111,11 +5122,11 @@ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5111
5122
|
]), ce = i((e, t = !1) => {
|
|
5112
5123
|
let r = n.current;
|
|
5113
5124
|
if (!r) return;
|
|
5114
|
-
let i =
|
|
5125
|
+
let i = us(e, y.buildIndex());
|
|
5115
5126
|
if (!i) return;
|
|
5116
5127
|
let a = i.getCenter(new I());
|
|
5117
5128
|
if (O.current = a.clone(), r.cancel(), t) {
|
|
5118
|
-
let e =
|
|
5129
|
+
let e = ds(i);
|
|
5119
5130
|
r.fitToBox(i, !0, {
|
|
5120
5131
|
paddingBottom: e,
|
|
5121
5132
|
paddingLeft: e,
|
|
@@ -5161,7 +5172,7 @@ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5161
5172
|
}), [_, t]), o(() => {
|
|
5162
5173
|
if (!s.current) return;
|
|
5163
5174
|
let t = requestAnimationFrame(() => {
|
|
5164
|
-
s.current?.updateMatrixWorld(!0), (_ instanceof se || _ instanceof oe) &&
|
|
5175
|
+
s.current?.updateMatrixWorld(!0), (_ instanceof se || _ instanceof oe) && cs(_, s.current), N(), ee(), D(), te(), w.syncWithModel(), T.syncWithModel(), e && ae();
|
|
5165
5176
|
});
|
|
5166
5177
|
return () => cancelAnimationFrame(t);
|
|
5167
5178
|
}, [
|
|
@@ -5233,6 +5244,8 @@ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5233
5244
|
geometryUtils: {
|
|
5234
5245
|
getAllIds: b.getAllIds,
|
|
5235
5246
|
getIfcSpacesVisibility: b.getIfcSpacesVisibility,
|
|
5247
|
+
getModelGeometry: (e) => ss(s.current, e),
|
|
5248
|
+
getModelsGeometry: () => os(s.current),
|
|
5236
5249
|
hideByIds: (e) => t(() => b.hideByIds(e)),
|
|
5237
5250
|
hideSelected: () => t(b.hideSelected),
|
|
5238
5251
|
isolateByIds: (e) => t(() => b.isolateByIds(e)),
|
|
@@ -5296,7 +5309,7 @@ function ls({ autoFitCamera: e, cameraRef: t, controlRef: n, lightRef: r, materi
|
|
|
5296
5309
|
})
|
|
5297
5310
|
] });
|
|
5298
5311
|
}
|
|
5299
|
-
function
|
|
5312
|
+
function ps({ autoFitCamera: e = !0, camera: t = {
|
|
5300
5313
|
position: [
|
|
5301
5314
|
10,
|
|
5302
5315
|
10,
|
|
@@ -5344,7 +5357,7 @@ function us({ autoFitCamera: e = !0, camera: t = {
|
|
|
5344
5357
|
gl: f ? Ko : void 0,
|
|
5345
5358
|
children: /* @__PURE__ */ L(Ir, {
|
|
5346
5359
|
store: C,
|
|
5347
|
-
children: /* @__PURE__ */ L(
|
|
5360
|
+
children: /* @__PURE__ */ L(fs, {
|
|
5348
5361
|
autoFitCamera: e,
|
|
5349
5362
|
cameraRef: _,
|
|
5350
5363
|
controlRef: v,
|
|
@@ -5374,7 +5387,7 @@ function us({ autoFitCamera: e = !0, camera: t = {
|
|
|
5374
5387
|
})]
|
|
5375
5388
|
}) : /* @__PURE__ */ L(Ce, {});
|
|
5376
5389
|
}
|
|
5377
|
-
var
|
|
5390
|
+
var ms = n(function(e, t) {
|
|
5378
5391
|
let [n] = u(Ae), r = l(!1), a = l(!1), d = c(() => new Bo(), []), { defaultSelected: f, onSelectedChange: p, selected: m } = e, h = i((e) => {
|
|
5379
5392
|
d.set(e);
|
|
5380
5393
|
}, [d]), g = c(() => ba(n, d.get), [d, n]);
|
|
@@ -5394,13 +5407,13 @@ var ds = n(function(e, t) {
|
|
|
5394
5407
|
});
|
|
5395
5408
|
}, [p, n]), /* @__PURE__ */ L(Ir, {
|
|
5396
5409
|
store: n,
|
|
5397
|
-
children: /* @__PURE__ */ L(
|
|
5410
|
+
children: /* @__PURE__ */ L(ps, {
|
|
5398
5411
|
...e,
|
|
5399
5412
|
publicApi: g,
|
|
5400
5413
|
setSceneApi: h
|
|
5401
5414
|
})
|
|
5402
5415
|
});
|
|
5403
5416
|
});
|
|
5404
|
-
|
|
5417
|
+
ms.displayName = "Viewer";
|
|
5405
5418
|
//#endregion
|
|
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,
|
|
5419
|
+
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, ms 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 };
|