bimatter-viewer-react 0.11.2 → 0.11.4
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/lib/{IFCLoader-N1C1bJ4O.js → IFCLoader-CQYQx4TL.js} +64 -41
- package/lib/Loaders/IFCLoader/PropertySerializer.d.ts +3 -0
- package/lib/api/ViewerApi.d.ts +1 -0
- package/lib/assets/{BmtConverterWorker-C90sCwAT.js → BmtConverterWorker-D6_8Zn9y.js} +1 -1
- package/lib/assets/{IFCWorker-pZu61wpO.js → IFCWorker-CfepOBoh.js} +1 -1
- package/lib/index.js +317 -279
- package/lib/store/ViewerStore.d.ts +1 -0
- package/package.json +1 -1
|
@@ -191275,21 +191275,21 @@ var m_ = class {
|
|
|
191275
191275
|
ResetCache(e) {
|
|
191276
191276
|
return this.wasmModule.ResetCache(e);
|
|
191277
191277
|
}
|
|
191278
|
-
}, h_ = 1e4;
|
|
191279
|
-
function
|
|
191278
|
+
}, h_ = 1e4, g_ = "IfcPhysicalComplexQuantity";
|
|
191279
|
+
function __(e) {
|
|
191280
191280
|
return !!e && typeof e == "object" && "value" in e;
|
|
191281
191281
|
}
|
|
191282
|
-
function
|
|
191283
|
-
let t =
|
|
191282
|
+
function v_(e) {
|
|
191283
|
+
let t = __(e) ? e.value : e;
|
|
191284
191284
|
return typeof t == "number" && Number.isFinite(t) ? t : null;
|
|
191285
191285
|
}
|
|
191286
|
-
function
|
|
191286
|
+
function y_(e) {
|
|
191287
191287
|
return (Array.isArray(e) ? e : [e]).flatMap((e) => {
|
|
191288
|
-
let t =
|
|
191288
|
+
let t = v_(e);
|
|
191289
191289
|
return t === null ? [] : [t];
|
|
191290
191290
|
});
|
|
191291
191291
|
}
|
|
191292
|
-
var
|
|
191292
|
+
var b_ = class {
|
|
191293
191293
|
PropsNames = {
|
|
191294
191294
|
aggregates: {
|
|
191295
191295
|
name: w,
|
|
@@ -191342,14 +191342,14 @@ var y_ = class {
|
|
|
191342
191342
|
let l = await this.getItemPropertiesBatch(e, i), u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
|
|
191343
191343
|
for (let e of l.values()) {
|
|
191344
191344
|
if (!e) continue;
|
|
191345
|
-
let t =
|
|
191345
|
+
let t = v_(e.RelatingPropertyDefinition);
|
|
191346
191346
|
t !== null && u.add(t);
|
|
191347
|
-
for (let t of
|
|
191347
|
+
for (let t of y_(e.RelatedObjects)) d.add(t);
|
|
191348
191348
|
}
|
|
191349
191349
|
let f = await this.getItemPropertiesBatch(e, u), p = /* @__PURE__ */ new Set();
|
|
191350
191350
|
for (let e of f.values()) if (e) {
|
|
191351
|
-
for (let t of
|
|
191352
|
-
for (let t of
|
|
191351
|
+
for (let t of y_(e.HasProperties)) p.add(t);
|
|
191352
|
+
for (let t of y_(e.Quantities)) p.add(t);
|
|
191353
191353
|
}
|
|
191354
191354
|
await this.getItemPropertiesBatch(e, p);
|
|
191355
191355
|
let m = new Set(t);
|
|
@@ -191365,7 +191365,7 @@ var y_ = class {
|
|
|
191365
191365
|
for (let t of i) {
|
|
191366
191366
|
let r = await this.getItemProperty(e, t);
|
|
191367
191367
|
if (r) {
|
|
191368
|
-
let t =
|
|
191368
|
+
let t = v_(r.RelatingPropertyDefinition);
|
|
191369
191369
|
if (t === null) continue;
|
|
191370
191370
|
let n = await this.getPropertySetData(e, t), i = {
|
|
191371
191371
|
id: t,
|
|
@@ -191381,7 +191381,7 @@ var y_ = class {
|
|
|
191381
191381
|
props: n.HasProperties ? n.HasProperties : n.Quantities ? n.Quantities : [],
|
|
191382
191382
|
isQuantities: !!n.Quantities
|
|
191383
191383
|
});
|
|
191384
|
-
let a =
|
|
191384
|
+
let a = y_(r.RelatedObjects);
|
|
191385
191385
|
for (let t of a) if (s[t]) s[t].sets ??= [], s[t].sets.push(i);
|
|
191386
191386
|
else {
|
|
191387
191387
|
let n = await this.getItemProperty(e, t);
|
|
@@ -191552,15 +191552,38 @@ var y_ = class {
|
|
|
191552
191552
|
}
|
|
191553
191553
|
async readPropertySetItems(e, t) {
|
|
191554
191554
|
if (!t) return;
|
|
191555
|
-
let n =
|
|
191555
|
+
let n = y_(t);
|
|
191556
191556
|
if (n.length === 0) return;
|
|
191557
191557
|
let r = await this.getItemPropertiesBatch(e, n), i = [];
|
|
191558
|
-
for (let
|
|
191559
|
-
let
|
|
191560
|
-
|
|
191558
|
+
for (let t of n) {
|
|
191559
|
+
let n = r.get(t);
|
|
191560
|
+
n && i.push(await this.preparePropertySetItem(e, n));
|
|
191561
191561
|
}
|
|
191562
191562
|
return i;
|
|
191563
191563
|
}
|
|
191564
|
+
async preparePropertySetItem(e, t, n = /* @__PURE__ */ new Set()) {
|
|
191565
|
+
if (!this.isPhysicalComplexQuantity(t)) return t;
|
|
191566
|
+
let r = y_(t.HasQuantities), i = typeof t.expressID == "number" ? t.expressID : void 0;
|
|
191567
|
+
if (i !== void 0) {
|
|
191568
|
+
if (n.has(i)) return {
|
|
191569
|
+
...t,
|
|
191570
|
+
value: []
|
|
191571
|
+
};
|
|
191572
|
+
n.add(i);
|
|
191573
|
+
}
|
|
191574
|
+
let a = await this.getItemPropertiesBatch(e, r), o = [];
|
|
191575
|
+
for (let t of r) {
|
|
191576
|
+
let r = a.get(t);
|
|
191577
|
+
r && o.push(await this.preparePropertySetItem(e, r, n));
|
|
191578
|
+
}
|
|
191579
|
+
return i !== void 0 && n.delete(i), {
|
|
191580
|
+
...t,
|
|
191581
|
+
value: o
|
|
191582
|
+
};
|
|
191583
|
+
}
|
|
191584
|
+
isPhysicalComplexQuantity(e) {
|
|
191585
|
+
return e.type === g_;
|
|
191586
|
+
}
|
|
191564
191587
|
async getElementsAssembly(e) {
|
|
191565
191588
|
let t = await this.getSpatialTreeChunks(e), n = await this.getSpatialLineMap(e, t), r = await this.parser.GetLineIDsWithType(e, Xl), i = {}, a = [];
|
|
191566
191589
|
for (let o = 0; o < r.size(); o++) {
|
|
@@ -191586,7 +191609,7 @@ var y_ = class {
|
|
|
191586
191609
|
formatItemProperties(e) {
|
|
191587
191610
|
return e && (Object.keys(e).forEach((t) => {
|
|
191588
191611
|
let n = e[t];
|
|
191589
|
-
|
|
191612
|
+
__(n) ? e[t] = n.value : Array.isArray(n) && (e[t] = n.map((e) => __(e) ? e.value : e));
|
|
191590
191613
|
}), e);
|
|
191591
191614
|
}
|
|
191592
191615
|
async getAllRelDefinesByProps(e) {
|
|
@@ -191617,13 +191640,13 @@ var y_ = class {
|
|
|
191617
191640
|
if (a == null) return i;
|
|
191618
191641
|
Array.isArray(a) || (a = [a]);
|
|
191619
191642
|
for (let t = 0; t < a.length; t++) {
|
|
191620
|
-
let o =
|
|
191643
|
+
let o = v_(a[t]);
|
|
191621
191644
|
if (o === null) continue;
|
|
191622
191645
|
let s = (await this.parser.GetLine(e, o, !1, !1))[n.relating];
|
|
191623
191646
|
if (s != null) {
|
|
191624
191647
|
Array.isArray(s) || (s = [s]);
|
|
191625
191648
|
for (let t = 0; t < s.length; t++) {
|
|
191626
|
-
let n =
|
|
191649
|
+
let n = v_(s[t]);
|
|
191627
191650
|
n !== null && i.push(await this.parser.GetLine(e, n, r));
|
|
191628
191651
|
}
|
|
191629
191652
|
}
|
|
@@ -191640,7 +191663,7 @@ var y_ = class {
|
|
|
191640
191663
|
}
|
|
191641
191664
|
}
|
|
191642
191665
|
getValue(e) {
|
|
191643
|
-
if (
|
|
191666
|
+
if (__(e)) return this.getValue(e.value);
|
|
191644
191667
|
if (Array.isArray(e)) return e.map((e) => this.getValue(e));
|
|
191645
191668
|
if (e && typeof e == "object") {
|
|
191646
191669
|
let t = {};
|
|
@@ -191743,9 +191766,9 @@ var y_ = class {
|
|
|
191743
191766
|
return this.parser.GetLineIDsWithType(e, Sd).get(0);
|
|
191744
191767
|
}
|
|
191745
191768
|
saveChunk(e, t, n) {
|
|
191746
|
-
let r =
|
|
191769
|
+
let r = v_(n[t.relating]);
|
|
191747
191770
|
if (r === null) return;
|
|
191748
|
-
let i =
|
|
191771
|
+
let i = y_(n[t.related]);
|
|
191749
191772
|
e[r] == null ? e[r] = i : e[r] = e[r].concat(i);
|
|
191750
191773
|
}
|
|
191751
191774
|
shouldEmitProgress(e, t) {
|
|
@@ -191754,7 +191777,7 @@ var y_ = class {
|
|
|
191754
191777
|
};
|
|
191755
191778
|
//#endregion
|
|
191756
191779
|
//#region node_modules/three/examples/jsm/utils/BufferGeometryUtils.js
|
|
191757
|
-
function
|
|
191780
|
+
function x_(e, t = 1e-4) {
|
|
191758
191781
|
t = Math.max(t, 2 ** -52);
|
|
191759
191782
|
let n = {}, r = e.getIndex(), i = e.getAttribute("position"), a = r ? r.count : i.count, o = 0, s = Object.keys(e.attributes), c = {}, l = {}, u = [], d = [
|
|
191760
191783
|
"getX",
|
|
@@ -191807,10 +191830,10 @@ function b_(e, t = 1e-4) {
|
|
|
191807
191830
|
}
|
|
191808
191831
|
//#endregion
|
|
191809
191832
|
//#region src/viewer/Loaders/IFCLoader/IfcGrid.ts
|
|
191810
|
-
function
|
|
191833
|
+
function S_(e) {
|
|
191811
191834
|
return !!e && typeof e == "object" && "value" in e;
|
|
191812
191835
|
}
|
|
191813
|
-
var
|
|
191836
|
+
var C_ = class {
|
|
191814
191837
|
parser;
|
|
191815
191838
|
grid;
|
|
191816
191839
|
modelID;
|
|
@@ -191818,7 +191841,7 @@ var S_ = class {
|
|
|
191818
191841
|
this.parser = e, this.grid = n, this.modelID = t;
|
|
191819
191842
|
}
|
|
191820
191843
|
getCurValue(e) {
|
|
191821
|
-
return
|
|
191844
|
+
return S_(e) ? e.value : e;
|
|
191822
191845
|
}
|
|
191823
191846
|
getNumberValue(e) {
|
|
191824
191847
|
let t = Number(this.getCurValue(e));
|
|
@@ -191851,7 +191874,7 @@ var S_ = class {
|
|
|
191851
191874
|
let c = this.getNumberValue(i.AxisCurve);
|
|
191852
191875
|
if (c === null) continue;
|
|
191853
191876
|
let l = await this.parser.GetLine(this.modelID, c), u = l.Points;
|
|
191854
|
-
if (!u || (
|
|
191877
|
+
if (!u || (S_(u) && (u = [l.Points]), !Array.isArray(u))) continue;
|
|
191855
191878
|
let d = [];
|
|
191856
191879
|
for (let e of u) {
|
|
191857
191880
|
let t = this.getNumberValue(e);
|
|
@@ -191876,7 +191899,7 @@ var S_ = class {
|
|
|
191876
191899
|
let c = this.getNumberValue(i.AxisCurve);
|
|
191877
191900
|
if (c === null) continue;
|
|
191878
191901
|
let l = await this.parser.GetLine(this.modelID, c), u = l.Points;
|
|
191879
|
-
if (!u || (
|
|
191902
|
+
if (!u || (S_(u) && (u = [l.Points]), !Array.isArray(u))) continue;
|
|
191880
191903
|
let d = [];
|
|
191881
191904
|
for (let e of u) {
|
|
191882
191905
|
let t = this.getNumberValue(e);
|
|
@@ -191909,13 +191932,13 @@ var S_ = class {
|
|
|
191909
191932
|
z: -(this.getScaledCoordinate(c, 1) ?? 0)
|
|
191910
191933
|
}, d.points = e, d;
|
|
191911
191934
|
}
|
|
191912
|
-
},
|
|
191935
|
+
}, w_ = 1e-5, T_ = {
|
|
191913
191936
|
b: .55,
|
|
191914
191937
|
g: .55,
|
|
191915
191938
|
name: -1,
|
|
191916
191939
|
opacity: .18,
|
|
191917
191940
|
r: .55
|
|
191918
|
-
},
|
|
191941
|
+
}, E_ = class {
|
|
191919
191942
|
useIfcElemetAssembly = !1;
|
|
191920
191943
|
useIfcColors = !1;
|
|
191921
191944
|
useIfcSpace = !0;
|
|
@@ -191929,7 +191952,7 @@ var S_ = class {
|
|
|
191929
191952
|
chunk = 1e3;
|
|
191930
191953
|
maxMeshBytes = 128 * 1024 * 1024;
|
|
191931
191954
|
constructor() {
|
|
191932
|
-
this.parser = new m_(), this.parser.SetWasmPath(this._wasmPath, !1), this.propertySerializer = new
|
|
191955
|
+
this.parser = new m_(), this.parser.SetWasmPath(this._wasmPath, !1), this.propertySerializer = new b_(this.parser);
|
|
191933
191956
|
}
|
|
191934
191957
|
getPath = () => {
|
|
191935
191958
|
if (/\.wasm$/i.test(this._wasmPath)) return this._wasmPath;
|
|
@@ -191948,7 +191971,7 @@ var S_ = class {
|
|
|
191948
191971
|
return this.parser;
|
|
191949
191972
|
}
|
|
191950
191973
|
set _parser(e) {
|
|
191951
|
-
this.parser = e, this.propertySerializer = new
|
|
191974
|
+
this.parser = e, this.propertySerializer = new b_(this.parser), this.parserReady = null;
|
|
191952
191975
|
}
|
|
191953
191976
|
async loadModel(e, t, n) {
|
|
191954
191977
|
await this.initParser(this.getPath), this.setCoordinationMatrix(t);
|
|
@@ -192013,7 +192036,7 @@ var S_ = class {
|
|
|
192013
192036
|
}
|
|
192014
192037
|
if (console.log("spend to read ifc file: ", Date.now() - r, "ms"), a === -1) return console.error("Model loading error"), !1;
|
|
192015
192038
|
try {
|
|
192016
|
-
let e = this.coordinationMatrix?.toArray(), t = new
|
|
192039
|
+
let e = this.coordinationMatrix?.toArray(), t = new D_(this.parser, a, {
|
|
192017
192040
|
geometryTransformation: e,
|
|
192018
192041
|
maxGeometriesPerMesh: this.chunk,
|
|
192019
192042
|
maxMeshBytes: this.maxMeshBytes,
|
|
@@ -192037,7 +192060,7 @@ var S_ = class {
|
|
|
192037
192060
|
if (!d) throw Error("IFC coordination matrix is not initialized");
|
|
192038
192061
|
let f = this.parser.GetLineIDsWithType(a, Cl), p = {};
|
|
192039
192062
|
if (f && f.size()) for (let e = 0; e < f.size(); e++) {
|
|
192040
|
-
let t = f.get(e), n = await new
|
|
192063
|
+
let t = f.get(e), n = await new C_(this.parser, a, t).init();
|
|
192041
192064
|
n && (p[t] = this.transformGridData(n, d));
|
|
192042
192065
|
}
|
|
192043
192066
|
n?.onPhase?.("properties");
|
|
@@ -192145,7 +192168,7 @@ var S_ = class {
|
|
|
192145
192168
|
}
|
|
192146
192169
|
};
|
|
192147
192170
|
}
|
|
192148
|
-
},
|
|
192171
|
+
}, D_ = class {
|
|
192149
192172
|
materials = {};
|
|
192150
192173
|
elementsAssembly = null;
|
|
192151
192174
|
parser;
|
|
@@ -192164,7 +192187,7 @@ var S_ = class {
|
|
|
192164
192187
|
let i = this.planGeometryChunks();
|
|
192165
192188
|
n && this.planGeometryChunks(i, {
|
|
192166
192189
|
isIfcSpace: !0,
|
|
192167
|
-
material:
|
|
192190
|
+
material: T_,
|
|
192168
192191
|
types: [Ic]
|
|
192169
192192
|
}), this.applyGeometryTransformation();
|
|
192170
192193
|
let a = this.createChunkBuilders(i), o = /* @__PURE__ */ new Map(), s = {
|
|
@@ -192174,7 +192197,7 @@ var S_ = class {
|
|
|
192174
192197
|
};
|
|
192175
192198
|
return this.streamGeometryChunks(a, o, e, {}, s), n && this.streamGeometryChunks(a, o, e, {
|
|
192176
192199
|
isIfcSpace: !0,
|
|
192177
|
-
material:
|
|
192200
|
+
material: T_,
|
|
192178
192201
|
types: [Ic]
|
|
192179
192202
|
}, s), this.createModelDataFromChunks(a, r);
|
|
192180
192203
|
}
|
|
@@ -192190,7 +192213,7 @@ var S_ = class {
|
|
|
192190
192213
|
};
|
|
192191
192214
|
return this.streamDynamicGeometryChunks(r, e, {}, i), t && this.streamDynamicGeometryChunks(r, e, {
|
|
192192
192215
|
isIfcSpace: !0,
|
|
192193
|
-
material:
|
|
192216
|
+
material: T_,
|
|
192194
192217
|
types: [Ic]
|
|
192195
192218
|
}, i), this.flushDynamicGeometryChunks(r, i), {
|
|
192196
192219
|
data: {},
|
|
@@ -192484,7 +192507,7 @@ var S_ = class {
|
|
|
192484
192507
|
if (!o || c < 3 || !Number.isInteger(c) || o.length !== s.length || r.length !== c || i.length < 3) return null;
|
|
192485
192508
|
let l = new e(), u = null;
|
|
192486
192509
|
try {
|
|
192487
|
-
l.setAttribute("position", new n(s, 3)), l.setAttribute("normal", new n(o, 3)), l.setAttribute("ids", new a(r, 1)), l.setIndex(new a(this.toUint32Array(i), 1)), u =
|
|
192510
|
+
l.setAttribute("position", new n(s, 3)), l.setAttribute("normal", new n(o, 3)), l.setAttribute("ids", new a(r, 1)), l.setIndex(new a(this.toUint32Array(i), 1)), u = x_(l, w_);
|
|
192488
192511
|
let e = u.getAttribute("position")?.array, t = u.getAttribute("normal")?.array, c = u.getAttribute("ids")?.array, d = u.getIndex()?.array;
|
|
192489
192512
|
return !(e instanceof Float32Array) || !(t instanceof Float32Array) || !c || !d ? null : {
|
|
192490
192513
|
ids: this.toUint32Array(c),
|
|
@@ -192534,4 +192557,4 @@ var S_ = class {
|
|
|
192534
192557
|
}
|
|
192535
192558
|
};
|
|
192536
192559
|
//#endregion
|
|
192537
|
-
export {
|
|
192560
|
+
export { E_ as IFCLoader };
|
|
@@ -11,6 +11,7 @@ type IfcLineData = Record<string, IfcRawValue> & {
|
|
|
11
11
|
Elevation?: BmtPropertyValue;
|
|
12
12
|
GlobalId?: BmtPropertyValue;
|
|
13
13
|
HasProperties?: BmtPropertyRecord[];
|
|
14
|
+
HasQuantities?: IfcRawValue[];
|
|
14
15
|
LongName?: BmtPropertyValue;
|
|
15
16
|
Name?: BmtPropertyValue;
|
|
16
17
|
ObjectType?: BmtPropertyValue;
|
|
@@ -62,6 +63,8 @@ export declare class PropertySerializer {
|
|
|
62
63
|
private clearPropertyCaches;
|
|
63
64
|
private getPropertySetData;
|
|
64
65
|
private readPropertySetItems;
|
|
66
|
+
private preparePropertySetItem;
|
|
67
|
+
private isPhysicalComplexQuantity;
|
|
65
68
|
getElementsAssembly(modelID: number): Promise<IfcElementsAssembly>;
|
|
66
69
|
private formatItemProperties;
|
|
67
70
|
private getAllRelDefinesByProps;
|
package/lib/api/ViewerApi.d.ts
CHANGED
|
@@ -135,6 +135,7 @@ export type ViewerModelsApi = {
|
|
|
135
135
|
getProgress: () => WorkerProgressEvent | null;
|
|
136
136
|
loadModels: (sources: ViewerModelSource[], options?: ViewerLoadModelsOptions) => Promise<ViewerLoadedModels>;
|
|
137
137
|
reset: () => void;
|
|
138
|
+
unloadModel: (modelID: number) => void;
|
|
138
139
|
};
|
|
139
140
|
export type ViewerPostproductionApi = {
|
|
140
141
|
getAmbientLightColor: () => ColorRepresentation;
|