@margoengine/ifc 0.0.0-stage → 1.0.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/LICENSE +201 -0
- package/NOTICE +4 -0
- package/NOTICE.md +16 -0
- package/README.md +365 -2
- package/dist/bcf-wKfMzfyy.js +871 -0
- package/dist/bcf.d.ts +274 -0
- package/dist/bcf.js +1 -0
- package/dist/data-CuTaQPFm.js +534 -0
- package/dist/data.d.ts +205 -0
- package/dist/data.js +1 -0
- package/dist/ids.d.ts +199 -0
- package/dist/ids.js +759 -0
- package/dist/ifc-stream.worker.d.ts +1 -0
- package/dist/ifc.worker.d.ts +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +116 -0
- package/dist/meshes.d.ts +75 -0
- package/dist/open-D1NQyRTk.js +181 -0
- package/dist/open.d.ts +39 -0
- package/dist/predefined-enums.d.ts +2 -0
- package/dist/query.d.ts +62 -0
- package/dist/query.js +92 -0
- package/dist/raw.d.ts +7 -0
- package/dist/scene.d.ts +187 -0
- package/dist/scene.js +642 -0
- package/dist/schema-B_VBQpdF.js +51 -0
- package/dist/schema-tree.d.ts +2 -0
- package/dist/schema.d.ts +16 -0
- package/dist/section.d.ts +95 -0
- package/dist/section.js +380 -0
- package/dist/step.d.ts +1 -0
- package/dist/tolerance-CAOnp3Mo.js +7 -0
- package/dist/tolerance.d.ts +2 -0
- package/dist/units-B32iYdmV.js +134 -0
- package/dist/units.d.ts +33 -0
- package/dist/worker.d.ts +38 -0
- package/dist/worker.js +108 -0
- package/dist/workers/ifc-stream.js +1 -0
- package/dist/workers/ifc.js +1 -0
- package/dist/write.d.ts +113 -0
- package/dist/write.js +546 -0
- package/package.json +100 -4
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
import { a as e, n as t, r as n, t as r } from "./open-D1NQyRTk.js";
|
|
2
|
+
import { a as i, c as a, i as o, l as s, n as c, o as l, s as u, t as d, u as f } from "./units-B32iYdmV.js";
|
|
3
|
+
//#region src/predefined-enums.ts
|
|
4
|
+
var p = "DoorPanelProperties:PanelOperation=DoorPanelOperationEnum,PanelPosition=DoorPanelPositionEnum PermeableCoveringProperties:OperationType=PermeableCoveringOperationEnum,PanelPosition=WindowPanelPositionEnum WindowPanelProperties:OperationType=WindowPanelOperationEnum,PanelPosition=WindowPanelPositionEnum", m = "DoorPanelProperties:PanelOperation=DoorPanelOperationEnum,PanelPosition=DoorPanelPositionEnum PermeableCoveringProperties:OperationType=PermeableCoveringOperationEnum,PanelPosition=WindowPanelPositionEnum WindowPanelProperties:OperationType=WindowPanelOperationEnum,PanelPosition=WindowPanelPositionEnum", h = (e) => e && typeof e.name == "string" ? e.name.toUpperCase() : void 0, g = /* @__PURE__ */ new Set([
|
|
5
|
+
"expressID",
|
|
6
|
+
"type",
|
|
7
|
+
"GlobalId",
|
|
8
|
+
"OwnerHistory"
|
|
9
|
+
]), _ = /^IFC[A-Z]+PROPERTIES$/, v = /* @__PURE__ */ new Map();
|
|
10
|
+
function y(e, t, n) {
|
|
11
|
+
let r = e.toUpperCase().startsWith("IFC4X3") ? "IFC4X3" : "IFC4", i = v.get(r);
|
|
12
|
+
if (!i) {
|
|
13
|
+
i = /* @__PURE__ */ new Map();
|
|
14
|
+
for (let e of (r === "IFC4X3" ? m : p).split(" ")) {
|
|
15
|
+
let [t, n] = e.split(":");
|
|
16
|
+
for (let e of n.split(",")) {
|
|
17
|
+
let [n, r] = e.split("=");
|
|
18
|
+
i.set(`IFC${t.toUpperCase()}.${n}`, `IFC${r.toUpperCase()}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
v.set(r, i);
|
|
22
|
+
}
|
|
23
|
+
return i.get(`${t}.${n}`);
|
|
24
|
+
}
|
|
25
|
+
function b(p, m = {}) {
|
|
26
|
+
t(p), r(m.signal);
|
|
27
|
+
let { api: v, id: b } = p, w = /* @__PURE__ */ new Map(), D = (t) => t === void 0 ? void 0 : w.get(t) ?? (w.set(t, e("reading a line", () => v.GetLine(b, t))), w.get(t)), O = /* @__PURE__ */ new Map(), k = (t) => {
|
|
28
|
+
let n = O.get(t.type);
|
|
29
|
+
return n === void 0 && O.set(t.type, n = e("reading a type name", () => v.GetNameFromTypeCode(t.type))), n;
|
|
30
|
+
}, A = (e) => k(e).toUpperCase(), j = n(p), M = (t, n = !1) => {
|
|
31
|
+
let r = e(`listing ${t}`, () => v.GetLineIDsWithType(b, v.GetTypeCodeFromName(t), n)), i = [];
|
|
32
|
+
for (let e = 0; e < r.size(); e++) j.has(r.get(e)) || i.push(r.get(e));
|
|
33
|
+
return i.sort((e, t) => e - t);
|
|
34
|
+
}, N = c(D, A, M), P = (e) => e ? N.byType[e] ?? o(e) : void 0, F = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
|
|
35
|
+
for (let e of M("IFCOBJECTDEFINITION", !0)) {
|
|
36
|
+
let t = D(e), n = {};
|
|
37
|
+
for (let e of Object.keys(t)) {
|
|
38
|
+
if (g.has(e)) continue;
|
|
39
|
+
let r = u(t[e]);
|
|
40
|
+
r !== void 0 && (n[e] = r);
|
|
41
|
+
}
|
|
42
|
+
let r = {
|
|
43
|
+
id: e,
|
|
44
|
+
type: k(t),
|
|
45
|
+
attributes: n,
|
|
46
|
+
psets: [],
|
|
47
|
+
materials: [],
|
|
48
|
+
classifications: []
|
|
49
|
+
}, i = (e, n) => {
|
|
50
|
+
let i = f(t[n]);
|
|
51
|
+
i !== void 0 && (r[e] = i);
|
|
52
|
+
};
|
|
53
|
+
i("globalId", "GlobalId"), i("name", "Name"), i("description", "Description"), i("objectType", "ObjectType"), i("tag", "Tag"), i("predefinedType", "PredefinedType"), i("elementType", "ElementType"), r.elementType === void 0 && i("elementType", "ProcessType"), r.elementType === void 0 && i("elementType", "ResourceType"), F.set(e, r), r.globalId && I.set(r.globalId, e);
|
|
54
|
+
}
|
|
55
|
+
r(m.signal);
|
|
56
|
+
let L = /* @__PURE__ */ new Map(), R = (e) => {
|
|
57
|
+
let t = A(e), n = f(e.Name) ?? "", r = e.Unit !== void 0 && a(e.Unit) !== void 0 ? i(D(a(e.Unit)), D, A) : void 0, o = (e) => {
|
|
58
|
+
let t = u(e) ?? null, n = h(e), i = l(n), a = r ?? P(i);
|
|
59
|
+
return a && typeof t == "number" ? {
|
|
60
|
+
value: t * a.scale + a.shift,
|
|
61
|
+
raw: t,
|
|
62
|
+
unit: a.symbol || void 0,
|
|
63
|
+
dataType: n
|
|
64
|
+
} : {
|
|
65
|
+
value: t,
|
|
66
|
+
raw: t,
|
|
67
|
+
dataType: n
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
if (t === "IFCPROPERTYSINGLEVALUE") return {
|
|
71
|
+
name: n,
|
|
72
|
+
kind: "single",
|
|
73
|
+
...o(e.NominalValue)
|
|
74
|
+
};
|
|
75
|
+
if (t === "IFCPROPERTYENUMERATEDVALUE" || t === "IFCPROPERTYLISTVALUE") {
|
|
76
|
+
let r = (e[t === "IFCPROPERTYLISTVALUE" ? "ListValues" : "EnumerationValues"] ?? []).map(o);
|
|
77
|
+
return {
|
|
78
|
+
name: n,
|
|
79
|
+
kind: t === "IFCPROPERTYLISTVALUE" ? "list" : "enumerated",
|
|
80
|
+
value: r.map((e) => e.value),
|
|
81
|
+
raw: r.map((e) => e.raw),
|
|
82
|
+
dataType: r[0]?.dataType,
|
|
83
|
+
unit: r[0]?.unit
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (t === "IFCPROPERTYBOUNDEDVALUE") {
|
|
87
|
+
let t = o(e.LowerBoundValue), r = o(e.UpperBoundValue), i = o(e.SetPointValue);
|
|
88
|
+
return {
|
|
89
|
+
name: n,
|
|
90
|
+
kind: "bounded",
|
|
91
|
+
value: i.value,
|
|
92
|
+
raw: i.raw,
|
|
93
|
+
lower: typeof t.value == "number" ? t.value : null,
|
|
94
|
+
upper: typeof r.value == "number" ? r.value : null,
|
|
95
|
+
dataType: t.dataType ?? r.dataType ?? i.dataType,
|
|
96
|
+
unit: t.unit ?? r.unit ?? i.unit
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
if (t === "IFCPROPERTYTABLEVALUE") {
|
|
100
|
+
let t = (e.DefiningValues ?? []).map(o), r = (e.DefinedValues ?? []).map(o);
|
|
101
|
+
return {
|
|
102
|
+
name: n,
|
|
103
|
+
kind: "table",
|
|
104
|
+
value: r.map((e) => e.value),
|
|
105
|
+
raw: t.map((e, t) => [e.raw, r[t]?.raw ?? null]),
|
|
106
|
+
dataType: r[0]?.dataType,
|
|
107
|
+
unit: r[0]?.unit,
|
|
108
|
+
defining: t.map((e) => e.value),
|
|
109
|
+
definingDataType: t[0]?.dataType
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (t === "IFCPROPERTYREFERENCEVALUE") {
|
|
113
|
+
let t = D(a(e.PropertyReference)), r = t ? f(t.Name) ?? f(t.Identification) ?? f(t.Location) ?? null : null;
|
|
114
|
+
return {
|
|
115
|
+
name: n,
|
|
116
|
+
kind: "reference",
|
|
117
|
+
value: r,
|
|
118
|
+
raw: r
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
if (t === "IFCCOMPLEXPROPERTY") {
|
|
122
|
+
let t = {};
|
|
123
|
+
for (let n of s(e.HasProperties)) {
|
|
124
|
+
let e = R(D(n));
|
|
125
|
+
e && (t[e.name] = e);
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
name: n,
|
|
129
|
+
kind: "complex",
|
|
130
|
+
value: null,
|
|
131
|
+
raw: null,
|
|
132
|
+
properties: t
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
if (t.startsWith("IFCQUANTITY")) {
|
|
136
|
+
let i = Object.keys(e).find((e) => e.endsWith("Value")), a = i ? u(e[i]) ?? null : null, o = r ?? P(d[t]);
|
|
137
|
+
return o && typeof a == "number" ? {
|
|
138
|
+
name: n,
|
|
139
|
+
kind: "quantity",
|
|
140
|
+
value: a * o.scale + o.shift,
|
|
141
|
+
raw: a,
|
|
142
|
+
dataType: t,
|
|
143
|
+
unit: o.symbol || void 0
|
|
144
|
+
} : {
|
|
145
|
+
name: n,
|
|
146
|
+
kind: "quantity",
|
|
147
|
+
value: a,
|
|
148
|
+
raw: a,
|
|
149
|
+
dataType: t
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}, z = (e) => {
|
|
153
|
+
if (L.has(e)) return L.get(e);
|
|
154
|
+
let t = D(e), n = t ? A(t) : "", r = null;
|
|
155
|
+
if (n === "IFCPROPERTYSET" || n === "IFCELEMENTQUANTITY") {
|
|
156
|
+
let i = {};
|
|
157
|
+
for (let e of s(n === "IFCPROPERTYSET" ? t.HasProperties : t.Quantities)) {
|
|
158
|
+
let t = R(D(e));
|
|
159
|
+
t && (i[t.name] = t);
|
|
160
|
+
}
|
|
161
|
+
r = {
|
|
162
|
+
id: e,
|
|
163
|
+
name: f(t.Name) ?? "",
|
|
164
|
+
quantities: n === "IFCELEMENTQUANTITY",
|
|
165
|
+
properties: i
|
|
166
|
+
};
|
|
167
|
+
let a = f(t.GlobalId);
|
|
168
|
+
a && (r.globalId = a);
|
|
169
|
+
} else if (n === "IFCMATERIALPROPERTIES" || n === "IFCEXTENDEDMATERIALPROPERTIES") {
|
|
170
|
+
let i = {};
|
|
171
|
+
for (let e of s(n === "IFCMATERIALPROPERTIES" ? t.Properties : t.ExtendedProperties)) {
|
|
172
|
+
let t = R(D(e));
|
|
173
|
+
t && (i[t.name] = t);
|
|
174
|
+
}
|
|
175
|
+
r = {
|
|
176
|
+
id: e,
|
|
177
|
+
name: f(t.Name) ?? "",
|
|
178
|
+
quantities: !1,
|
|
179
|
+
properties: i
|
|
180
|
+
};
|
|
181
|
+
} else if (t && _.test(n)) {
|
|
182
|
+
let i = {};
|
|
183
|
+
for (let e of Object.keys(t)) {
|
|
184
|
+
if (g.has(e) || e === "Name" || e === "Description" || s(t[e]).length) continue;
|
|
185
|
+
let r = t[e];
|
|
186
|
+
if (r == null) continue;
|
|
187
|
+
let a = u(r) ?? null, o = h(r) ?? y(p.schema, n, e), c = P(l(o)), d = {
|
|
188
|
+
name: e,
|
|
189
|
+
kind: "single",
|
|
190
|
+
value: a,
|
|
191
|
+
raw: a
|
|
192
|
+
};
|
|
193
|
+
o && (d.dataType = o), c && typeof a == "number" && (d.value = a * c.scale + c.shift, c.symbol && (d.unit = c.symbol)), i[e] = d;
|
|
194
|
+
}
|
|
195
|
+
let a = k(t);
|
|
196
|
+
r = {
|
|
197
|
+
id: e,
|
|
198
|
+
name: f(t.Name) ?? a,
|
|
199
|
+
quantities: !1,
|
|
200
|
+
properties: i,
|
|
201
|
+
predefined: a
|
|
202
|
+
};
|
|
203
|
+
let o = f(t.GlobalId);
|
|
204
|
+
o && (r.globalId = o);
|
|
205
|
+
}
|
|
206
|
+
return L.set(e, r), r;
|
|
207
|
+
}, B = (e, t) => {
|
|
208
|
+
let n = z(t);
|
|
209
|
+
e && n && !e.psets.includes(n) && e.psets.push(n);
|
|
210
|
+
}, V = (e, t) => {
|
|
211
|
+
for (let n of M(e)) t(D(n));
|
|
212
|
+
r(m.signal);
|
|
213
|
+
};
|
|
214
|
+
if (m.properties !== !1) {
|
|
215
|
+
V("IFCRELDEFINESBYPROPERTIES", (e) => {
|
|
216
|
+
for (let t of s(e.RelatingPropertyDefinition)) for (let n of s(e.RelatedObjects)) B(F.get(n), t);
|
|
217
|
+
});
|
|
218
|
+
for (let e of F.values()) for (let t of s(D(e.id).HasPropertySets)) B(e, t);
|
|
219
|
+
}
|
|
220
|
+
let H = /* @__PURE__ */ new Map();
|
|
221
|
+
if (m.properties !== !1) for (let e of ["IFCMATERIALPROPERTIES", "IFCEXTENDEDMATERIALPROPERTIES"]) for (let t of p.schema.toUpperCase().startsWith("IFC2X3") === (e === "IFCEXTENDEDMATERIALPROPERTIES") ? M(e) : []) {
|
|
222
|
+
let e = a(D(t).Material), n = z(t);
|
|
223
|
+
e !== void 0 && n && (H.get(e) ?? H.set(e, []).get(e)).push(n);
|
|
224
|
+
}
|
|
225
|
+
V("IFCRELDEFINESBYTYPE", (e) => {
|
|
226
|
+
let t = a(e.RelatingType);
|
|
227
|
+
for (let n of s(e.RelatedObjects)) {
|
|
228
|
+
let e = F.get(n);
|
|
229
|
+
e && t !== void 0 && (e.typeId = t);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
let U = (e, t, n, r) => V(e, (e) => {
|
|
233
|
+
let i = a(e[t]);
|
|
234
|
+
for (let t of s(e[n])) {
|
|
235
|
+
let e = F.get(t);
|
|
236
|
+
e && i !== void 0 && (e[r] = i);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
U("IFCRELAGGREGATES", "RelatingObject", "RelatedObjects", "aggregate"), U("IFCRELNESTS", "RelatingObject", "RelatedObjects", "nest"), U("IFCRELCONTAINEDINSPATIALSTRUCTURE", "RelatingStructure", "RelatedElements", "container"), V("IFCRELREFERENCEDINSPATIALSTRUCTURE", (e) => {
|
|
240
|
+
let t = a(e.RelatingStructure);
|
|
241
|
+
for (let n of s(e.RelatedElements)) {
|
|
242
|
+
let e = F.get(n);
|
|
243
|
+
e && t !== void 0 && (e.references ??= []).push(t);
|
|
244
|
+
}
|
|
245
|
+
}), V("IFCRELVOIDSELEMENT", (e) => {
|
|
246
|
+
let t = F.get(a(e.RelatedOpeningElement)), n = a(e.RelatingBuildingElement);
|
|
247
|
+
t && n !== void 0 && (t.voids = n);
|
|
248
|
+
}), V("IFCRELFILLSELEMENT", (e) => {
|
|
249
|
+
let t = F.get(a(e.RelatedBuildingElement)), n = a(e.RelatingOpeningElement);
|
|
250
|
+
t && n !== void 0 && (t.fills = n);
|
|
251
|
+
}), V("IFCRELASSIGNSTOGROUP", (e) => {
|
|
252
|
+
let t = a(e.RelatingGroup);
|
|
253
|
+
for (let n of s(e.RelatedObjects)) {
|
|
254
|
+
let e = F.get(n);
|
|
255
|
+
e && t !== void 0 && (e.groups ??= []).push(t);
|
|
256
|
+
}
|
|
257
|
+
}), V("IFCRELASSOCIATESMATERIAL", (e) => {
|
|
258
|
+
let t = S(D(a(e.RelatingMaterial)), D, A, P("LENGTHUNIT"));
|
|
259
|
+
for (let n of s(e.RelatedObjects)) F.get(n)?.materials.push(...t);
|
|
260
|
+
}), V("IFCRELASSOCIATESCLASSIFICATION", (e) => {
|
|
261
|
+
let t = C(D(a(e.RelatingClassification)), D, A);
|
|
262
|
+
if (t) for (let n of s(e.RelatedObjects)) F.get(n)?.classifications.push(t);
|
|
263
|
+
});
|
|
264
|
+
let W = (e) => {
|
|
265
|
+
let t = /* @__PURE__ */ new Set();
|
|
266
|
+
for (let n = e; n && !t.has(n.id);) {
|
|
267
|
+
if (t.add(n.id), n !== e && n.type.toUpperCase() === "IFCBUILDINGSTOREY") return n.id;
|
|
268
|
+
let r = n.container ?? n.aggregate ?? n.nest ?? n.voids ?? n.fills;
|
|
269
|
+
n = r === void 0 ? void 0 : F.get(r);
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
for (let e of F.values()) {
|
|
273
|
+
let t = W(e);
|
|
274
|
+
t !== void 0 && (e.storey = t);
|
|
275
|
+
}
|
|
276
|
+
let G = P("LENGTHUNIT"), K = p.schema.toUpperCase().startsWith("IFC4") ? void 0 : x(p, F);
|
|
277
|
+
return r(m.signal), {
|
|
278
|
+
schema: p.schema,
|
|
279
|
+
units: N,
|
|
280
|
+
elements: F,
|
|
281
|
+
byGlobalId: I,
|
|
282
|
+
materialProperties: H,
|
|
283
|
+
spatial: T(F, G),
|
|
284
|
+
georeference: E(F, D, A, M, G),
|
|
285
|
+
...K && { inheritance: K }
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function x(t, n) {
|
|
289
|
+
let { api: r, id: i } = t, a = /* @__PURE__ */ new Map();
|
|
290
|
+
for (let t of e("listing the schema entities", () => r.GetIfcEntityList(i))) {
|
|
291
|
+
let o = e("listing a class with its subtypes", () => r.GetLineIDsWithType(i, t, !0)), s = o.size();
|
|
292
|
+
if (!s || s > n.size || !n.has(o.get(0))) continue;
|
|
293
|
+
let c = /* @__PURE__ */ new Set();
|
|
294
|
+
for (let e = 0; e < s; e++) {
|
|
295
|
+
let t = n.get(o.get(e));
|
|
296
|
+
t && c.add(t.type);
|
|
297
|
+
}
|
|
298
|
+
a.set(e("reading a type name", () => r.GetNameFromTypeCode(t)).toUpperCase(), [...c].sort());
|
|
299
|
+
}
|
|
300
|
+
return a;
|
|
301
|
+
}
|
|
302
|
+
function S(e, t, n, r) {
|
|
303
|
+
if (!e) return [];
|
|
304
|
+
let i = n(e), o = [], c = (e, t) => {
|
|
305
|
+
let n = f(e?.Name);
|
|
306
|
+
if (n === void 0 && t.part === void 0) return;
|
|
307
|
+
let r = {
|
|
308
|
+
name: n ?? "",
|
|
309
|
+
...t
|
|
310
|
+
}, i = f(e?.Category);
|
|
311
|
+
i !== void 0 && (r.category = i), o.push(r);
|
|
312
|
+
}, l = (e, n, i) => {
|
|
313
|
+
let s = { kind: n }, l = f(e.Name);
|
|
314
|
+
l !== void 0 && (s.part = l), i !== void 0 && (s.set = i);
|
|
315
|
+
let d = u(e.LayerThickness);
|
|
316
|
+
typeof d == "number" && (s.thickness = d * r.scale);
|
|
317
|
+
let p = u(e.Fraction);
|
|
318
|
+
typeof p == "number" && (s.fraction = p);
|
|
319
|
+
let m = f(e.Category);
|
|
320
|
+
c(t(a(e.Material)), s), m !== void 0 && o.length && (o[o.length - 1].category ??= m);
|
|
321
|
+
};
|
|
322
|
+
if (i === "IFCMATERIAL") c(e, { kind: "material" });
|
|
323
|
+
else if (i === "IFCMATERIALLIST") for (let n of s(e.Materials)) c(t(n), { kind: "material" });
|
|
324
|
+
else if (i === "IFCMATERIALLAYERSETUSAGE") return S(t(a(e.ForLayerSet)), t, n, r);
|
|
325
|
+
else if (i === "IFCMATERIALPROFILESETUSAGE" || i === "IFCMATERIALPROFILESETUSAGETAPERING") return S(t(a(e.ForProfileSet)), t, n, r);
|
|
326
|
+
else if (i === "IFCMATERIALLAYERSET") for (let n of s(e.MaterialLayers)) l(t(n), "layer", f(e.LayerSetName));
|
|
327
|
+
else if (i === "IFCMATERIALPROFILESET") for (let n of s(e.MaterialProfiles)) l(t(n), "profile", f(e.Name));
|
|
328
|
+
else if (i === "IFCMATERIALCONSTITUENTSET") for (let n of s(e.MaterialConstituents)) l(t(n), "constituent", f(e.Name));
|
|
329
|
+
else i === "IFCMATERIALLAYER" ? l(e, "layer", void 0) : i === "IFCMATERIALPROFILE" ? l(e, "profile", void 0) : i === "IFCMATERIALCONSTITUENT" && l(e, "constituent", void 0);
|
|
330
|
+
return o;
|
|
331
|
+
}
|
|
332
|
+
function C(e, t, n) {
|
|
333
|
+
if (!e) return;
|
|
334
|
+
let r = {}, i = [], o = e;
|
|
335
|
+
for (let s = 0; o && s < 32; s++) {
|
|
336
|
+
let s = n(o);
|
|
337
|
+
if (s === "IFCCLASSIFICATION") {
|
|
338
|
+
let e = f(o.Name);
|
|
339
|
+
e !== void 0 && (r.system = e);
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
if (s !== "IFCCLASSIFICATIONREFERENCE") break;
|
|
343
|
+
let c = f(o.Identification) ?? f(o.ItemReference);
|
|
344
|
+
if (o === e) {
|
|
345
|
+
c !== void 0 && (r.code = c);
|
|
346
|
+
let e = f(o.Name), t = f(o.Location);
|
|
347
|
+
e !== void 0 && (r.name = e), t !== void 0 && (r.uri = t);
|
|
348
|
+
} else c !== void 0 && i.unshift(c);
|
|
349
|
+
o = t(a(o.ReferencedSource));
|
|
350
|
+
}
|
|
351
|
+
return i.length && (r.parents = i), r;
|
|
352
|
+
}
|
|
353
|
+
var w = /^IFC(PROJECT|SITE|BUILDING|BUILDINGSTOREY|SPACE|SPATIALZONE|FACILITY|FACILITYPART|BRIDGE|BRIDGEPART|ROAD|ROADPART|RAILWAY|RAILWAYPART|MARINEFACILITY|MARINEPART|EXTERNALSPATIALELEMENT|SPATIALELEMENT|SPATIALSTRUCTUREELEMENT)$/;
|
|
354
|
+
function T(e, t) {
|
|
355
|
+
let n = [...e.values()].find((e) => e.type.toUpperCase() === "IFCPROJECT");
|
|
356
|
+
if (!n) return null;
|
|
357
|
+
let r = /* @__PURE__ */ new Map(), i = (e) => {
|
|
358
|
+
let n = r.get(e.id);
|
|
359
|
+
if (!n) {
|
|
360
|
+
n = {
|
|
361
|
+
id: e.id,
|
|
362
|
+
type: e.type,
|
|
363
|
+
children: [],
|
|
364
|
+
elements: []
|
|
365
|
+
}, e.name !== void 0 && (n.name = e.name);
|
|
366
|
+
let i = e.attributes.LongName;
|
|
367
|
+
typeof i == "string" && (n.longName = i);
|
|
368
|
+
let a = e.attributes.Elevation;
|
|
369
|
+
typeof a == "number" && e.type.toUpperCase() === "IFCBUILDINGSTOREY" && (n.elevation = a * t.scale), r.set(e.id, n);
|
|
370
|
+
}
|
|
371
|
+
return n;
|
|
372
|
+
};
|
|
373
|
+
i(n);
|
|
374
|
+
for (let t of e.values()) {
|
|
375
|
+
let n = t.aggregate ?? t.nest;
|
|
376
|
+
n !== void 0 && e.has(n) && i(e.get(n)).children.push(i(t)), t.container !== void 0 && e.has(t.container) && i(e.get(t.container)).elements.push(t.id);
|
|
377
|
+
}
|
|
378
|
+
let a = (e) => Number(w.test(e.type.toUpperCase()));
|
|
379
|
+
for (let e of r.values()) e.children.sort((e, t) => a(t) - a(e) || e.id - t.id);
|
|
380
|
+
return r.get(n.id);
|
|
381
|
+
}
|
|
382
|
+
function E(e, t, n, r, o) {
|
|
383
|
+
let s = null, c = (e, r) => {
|
|
384
|
+
let o = { mapUnit: 1 };
|
|
385
|
+
for (let e of [
|
|
386
|
+
"Name",
|
|
387
|
+
"Description",
|
|
388
|
+
"GeodeticDatum",
|
|
389
|
+
"VerticalDatum",
|
|
390
|
+
"MapProjection",
|
|
391
|
+
"MapZone"
|
|
392
|
+
]) {
|
|
393
|
+
let t = r(e);
|
|
394
|
+
typeof t == "string" && (o[e[0].toLowerCase() + e.slice(1)] = t);
|
|
395
|
+
}
|
|
396
|
+
let s = e ? i(t(a(e.MapUnit)), t, n) : void 0;
|
|
397
|
+
return s && (o.mapUnit = s.scale), o;
|
|
398
|
+
}, l = r("IFCMAPCONVERSION", !0)[0];
|
|
399
|
+
if (l !== void 0) {
|
|
400
|
+
let e = t(l), r = (t, n) => {
|
|
401
|
+
let r = u(e[t]);
|
|
402
|
+
return typeof r == "number" ? r : n;
|
|
403
|
+
}, i = t(a(e.TargetCRS));
|
|
404
|
+
s = {
|
|
405
|
+
source: n(e) === "IFCMAPCONVERSIONSCALED" ? "IfcMapConversionScaled" : "IfcMapConversion",
|
|
406
|
+
eastings: r("Eastings", 0),
|
|
407
|
+
northings: r("Northings", 0),
|
|
408
|
+
orthogonalHeight: r("OrthogonalHeight", 0),
|
|
409
|
+
xAxisAbscissa: r("XAxisAbscissa", 1),
|
|
410
|
+
xAxisOrdinate: r("XAxisOrdinate", 0),
|
|
411
|
+
rotation: 0,
|
|
412
|
+
scale: r("Scale", 1),
|
|
413
|
+
lengthUnit: o.scale
|
|
414
|
+
}, i && (s.crs = c(i, (e) => f(i[e]))), s.source === "IfcMapConversionScaled" && (s.factors = [
|
|
415
|
+
r("FactorX", 1),
|
|
416
|
+
r("FactorY", 1),
|
|
417
|
+
r("FactorZ", 1)
|
|
418
|
+
]);
|
|
419
|
+
} else {
|
|
420
|
+
let t, n;
|
|
421
|
+
for (let r of e.values()) for (let e of r.psets) e.name === "ePSet_MapConversion" && (t ??= e), e.name === "ePSet_ProjectedCRS" && (n ??= e);
|
|
422
|
+
if (t) {
|
|
423
|
+
let e = (e, n) => {
|
|
424
|
+
let r = t.properties[e]?.raw;
|
|
425
|
+
return typeof r == "number" ? r : n;
|
|
426
|
+
};
|
|
427
|
+
if (s = {
|
|
428
|
+
source: "ePSet_MapConversion",
|
|
429
|
+
eastings: e("Eastings", 0),
|
|
430
|
+
northings: e("Northings", 0),
|
|
431
|
+
orthogonalHeight: e("OrthogonalHeight", 0),
|
|
432
|
+
xAxisAbscissa: e("XAxisAbscissa", 1),
|
|
433
|
+
xAxisOrdinate: e("XAxisOrdinate", 0),
|
|
434
|
+
rotation: 0,
|
|
435
|
+
scale: e("Scale", 1),
|
|
436
|
+
lengthUnit: o.scale
|
|
437
|
+
}, n) {
|
|
438
|
+
let e = (e) => n.properties[e]?.raw;
|
|
439
|
+
s.crs = c(void 0, e);
|
|
440
|
+
let t = e("MapUnit");
|
|
441
|
+
typeof t == "string" && /FOOT|FEET/i.test(t) && (s.crs.mapUnit = /US/i.test(t) ? 1200 / 3937 : .3048);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
s && (s.rotation = Math.atan2(s.xAxisOrdinate, s.xAxisAbscissa));
|
|
446
|
+
let d = [...e.values()].find((e) => e.type.toUpperCase() === "IFCSITE"), p = (e) => Array.isArray(e) && e.length >= 3 && e.every((e) => typeof e == "number") ? e[0] + e[1] / 60 + (e[2] + (e[3] ?? 0) / 1e6) / 3600 : void 0, m = p(d?.attributes.RefLatitude), h = p(d?.attributes.RefLongitude), g = d?.attributes.RefElevation;
|
|
447
|
+
(m !== void 0 || h !== void 0) && (s ??= {
|
|
448
|
+
source: "IfcSite",
|
|
449
|
+
eastings: 0,
|
|
450
|
+
northings: 0,
|
|
451
|
+
orthogonalHeight: 0,
|
|
452
|
+
xAxisAbscissa: 1,
|
|
453
|
+
xAxisOrdinate: 0,
|
|
454
|
+
rotation: 0,
|
|
455
|
+
scale: 1,
|
|
456
|
+
lengthUnit: o.scale
|
|
457
|
+
}, m !== void 0 && (s.latitude = m), h !== void 0 && (s.longitude = h), typeof g == "number" && (s.elevation = g * o.scale));
|
|
458
|
+
for (let e of r("IFCGEOMETRICREPRESENTATIONCONTEXT")) {
|
|
459
|
+
let n = t(a(t(e).TrueNorth)), r = u(n?.DirectionRatios);
|
|
460
|
+
if (s && Array.isArray(r) && typeof r[0] == "number" && typeof r[1] == "number") {
|
|
461
|
+
s.trueNorth = Math.atan2(-r[0], r[1]);
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
return s;
|
|
466
|
+
}
|
|
467
|
+
function D(e, [t, n, r]) {
|
|
468
|
+
let i = e.scale / e.lengthUnit, [a, o, s] = e.factors ?? [
|
|
469
|
+
1,
|
|
470
|
+
1,
|
|
471
|
+
1
|
|
472
|
+
], c = t * i * a, l = n * i * o, u = r * i * s, d = Math.cos(e.rotation), f = Math.sin(e.rotation);
|
|
473
|
+
return [
|
|
474
|
+
e.eastings + d * c - f * l,
|
|
475
|
+
e.northings + f * c + d * l,
|
|
476
|
+
e.orthogonalHeight + u
|
|
477
|
+
];
|
|
478
|
+
}
|
|
479
|
+
function O(e, [t, n, r]) {
|
|
480
|
+
let i = e.scale / e.lengthUnit, [a, o, s] = e.factors ?? [
|
|
481
|
+
1,
|
|
482
|
+
1,
|
|
483
|
+
1
|
|
484
|
+
], c = t - e.eastings, l = n - e.northings, u = Math.cos(e.rotation), d = Math.sin(e.rotation);
|
|
485
|
+
return [
|
|
486
|
+
(u * c + d * l) / (i * a),
|
|
487
|
+
(-d * c + u * l) / (i * o),
|
|
488
|
+
(r - e.orthogonalHeight) / (i * s)
|
|
489
|
+
];
|
|
490
|
+
}
|
|
491
|
+
function k([e, t, n], r = [
|
|
492
|
+
0,
|
|
493
|
+
0,
|
|
494
|
+
0
|
|
495
|
+
]) {
|
|
496
|
+
return [
|
|
497
|
+
e + r[0],
|
|
498
|
+
-(n + r[2]),
|
|
499
|
+
t + r[1]
|
|
500
|
+
];
|
|
501
|
+
}
|
|
502
|
+
function A([e, t, n], r = [
|
|
503
|
+
0,
|
|
504
|
+
0,
|
|
505
|
+
0
|
|
506
|
+
]) {
|
|
507
|
+
return [
|
|
508
|
+
e - r[0],
|
|
509
|
+
n - r[1],
|
|
510
|
+
-t - r[2]
|
|
511
|
+
];
|
|
512
|
+
}
|
|
513
|
+
function j(e, t) {
|
|
514
|
+
let n = e.elements.get(t), r = {};
|
|
515
|
+
if (!n) return r;
|
|
516
|
+
let i = n.typeId === void 0 ? void 0 : e.elements.get(n.typeId);
|
|
517
|
+
for (let e of [...i?.psets ?? [], ...n.psets]) Object.assign(r[e.name] ??= {}, e.properties);
|
|
518
|
+
return r;
|
|
519
|
+
}
|
|
520
|
+
function M(e, t, n, r) {
|
|
521
|
+
return j(e, t)[n]?.[r];
|
|
522
|
+
}
|
|
523
|
+
function N(e, t) {
|
|
524
|
+
let n = e.elements.get(t);
|
|
525
|
+
return n ? n.materials.length || n.typeId === void 0 ? n.materials : e.elements.get(n.typeId)?.materials ?? [] : [];
|
|
526
|
+
}
|
|
527
|
+
function P(e, t) {
|
|
528
|
+
let n = e.elements.get(t);
|
|
529
|
+
if (!n) return [];
|
|
530
|
+
let r = n.typeId === void 0 ? void 0 : e.elements.get(n.typeId);
|
|
531
|
+
return [...n.classifications, ...r?.classifications ?? []];
|
|
532
|
+
}
|
|
533
|
+
//#endregion
|
|
534
|
+
export { N as a, M as c, O as i, b as l, k as n, D as o, A as r, j as s, P as t };
|