@ifc-lite/export 3.0.1 → 4.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/README.md +37 -1
- package/dist/anonymize-export.d.ts +60 -0
- package/dist/anonymize-export.d.ts.map +1 -0
- package/dist/anonymize-export.js +217 -0
- package/dist/anonymize-export.js.map +1 -0
- package/dist/anonymize-placement.d.ts +71 -0
- package/dist/anonymize-placement.d.ts.map +1 -0
- package/dist/anonymize-placement.js +266 -0
- package/dist/anonymize-placement.js.map +1 -0
- package/dist/anonymize-scrub.d.ts +64 -0
- package/dist/anonymize-scrub.d.ts.map +1 -0
- package/dist/anonymize-scrub.js +315 -0
- package/dist/anonymize-scrub.js.map +1 -0
- package/dist/anonymize-types.d.ts +235 -0
- package/dist/anonymize-types.d.ts.map +1 -0
- package/dist/anonymize-types.js +5 -0
- package/dist/anonymize-types.js.map +1 -0
- package/dist/declared-property-type.d.ts +15 -0
- package/dist/declared-property-type.d.ts.map +1 -1
- package/dist/declared-property-type.js +43 -0
- package/dist/declared-property-type.js.map +1 -1
- package/dist/entity-type-sets.d.ts +47 -0
- package/dist/entity-type-sets.d.ts.map +1 -0
- package/dist/entity-type-sets.js +91 -0
- package/dist/entity-type-sets.js.map +1 -0
- package/dist/georef-closure.d.ts +55 -0
- package/dist/georef-closure.d.ts.map +1 -0
- package/dist/georef-closure.js +95 -0
- package/dist/georef-closure.js.map +1 -0
- package/dist/glb.d.ts.map +1 -1
- package/dist/glb.js +26 -2
- package/dist/glb.js.map +1 -1
- package/dist/ifc5-classification.d.ts +36 -0
- package/dist/ifc5-classification.d.ts.map +1 -0
- package/dist/ifc5-classification.js +46 -0
- package/dist/ifc5-classification.js.map +1 -0
- package/dist/ifc5-export-helpers.d.ts +32 -0
- package/dist/ifc5-export-helpers.d.ts.map +1 -0
- package/dist/ifc5-export-helpers.js +84 -0
- package/dist/ifc5-export-helpers.js.map +1 -0
- package/dist/ifc5-exporter.d.ts.map +1 -1
- package/dist/ifc5-exporter.js +14 -86
- package/dist/ifc5-exporter.js.map +1 -1
- package/dist/ifc5-material.d.ts +38 -0
- package/dist/ifc5-material.d.ts.map +1 -0
- package/dist/ifc5-material.js +32 -0
- package/dist/ifc5-material.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/merged-context.d.ts +100 -0
- package/dist/merged-context.d.ts.map +1 -0
- package/dist/merged-context.js +211 -0
- package/dist/merged-context.js.map +1 -0
- package/dist/merged-empty-containers.d.ts +63 -0
- package/dist/merged-empty-containers.d.ts.map +1 -0
- package/dist/merged-empty-containers.js +354 -0
- package/dist/merged-empty-containers.js.map +1 -0
- package/dist/merged-exporter.d.ts +28 -67
- package/dist/merged-exporter.d.ts.map +1 -1
- package/dist/merged-exporter.js +134 -258
- package/dist/merged-exporter.js.map +1 -1
- package/dist/merged-guid.d.ts +48 -0
- package/dist/merged-guid.d.ts.map +1 -0
- package/dist/merged-guid.js +128 -0
- package/dist/merged-guid.js.map +1 -0
- package/dist/merged-rel-aggregates.d.ts +63 -0
- package/dist/merged-rel-aggregates.d.ts.map +1 -0
- package/dist/merged-rel-aggregates.js +122 -0
- package/dist/merged-rel-aggregates.js.map +1 -0
- package/dist/merged-remap.d.ts +18 -0
- package/dist/merged-remap.d.ts.map +1 -0
- package/dist/merged-remap.js +66 -0
- package/dist/merged-remap.js.map +1 -0
- package/dist/merged-subcontext.d.ts +41 -0
- package/dist/merged-subcontext.d.ts.map +1 -0
- package/dist/merged-subcontext.js +99 -0
- package/dist/merged-subcontext.js.map +1 -0
- package/dist/parquet-exporter-ondemand.d.ts +34 -0
- package/dist/parquet-exporter-ondemand.d.ts.map +1 -0
- package/dist/parquet-exporter-ondemand.js +89 -0
- package/dist/parquet-exporter-ondemand.js.map +1 -0
- package/dist/parquet-exporter.d.ts +1 -29
- package/dist/parquet-exporter.d.ts.map +1 -1
- package/dist/parquet-exporter.js +68 -90
- package/dist/parquet-exporter.js.map +1 -1
- package/dist/parquet-type-strings.d.ts +11 -0
- package/dist/parquet-type-strings.d.ts.map +1 -0
- package/dist/parquet-type-strings.js +40 -0
- package/dist/parquet-type-strings.js.map +1 -0
- package/dist/parquet-uint32-columns.d.ts +30 -0
- package/dist/parquet-uint32-columns.d.ts.map +1 -0
- package/dist/parquet-uint32-columns.js +38 -0
- package/dist/parquet-uint32-columns.js.map +1 -0
- package/dist/reference-collector.d.ts +47 -51
- package/dist/reference-collector.d.ts.map +1 -1
- package/dist/reference-collector.js +115 -171
- package/dist/reference-collector.js.map +1 -1
- package/dist/related-entities.d.ts +10 -0
- package/dist/related-entities.d.ts.map +1 -0
- package/dist/related-entities.js +274 -0
- package/dist/related-entities.js.map +1 -0
- package/dist/schema-converter-attr-remap.d.ts +53 -0
- package/dist/schema-converter-attr-remap.d.ts.map +1 -0
- package/dist/schema-converter-attr-remap.js +106 -0
- package/dist/schema-converter-attr-remap.js.map +1 -0
- package/dist/schema-converter.d.ts.map +1 -1
- package/dist/schema-converter.js +24 -1
- package/dist/schema-converter.js.map +1 -1
- package/dist/schema-untranslatable.d.ts +35 -0
- package/dist/schema-untranslatable.d.ts.map +1 -0
- package/dist/schema-untranslatable.js +60 -0
- package/dist/schema-untranslatable.js.map +1 -0
- package/dist/step-argument-parser.d.ts.map +1 -1
- package/dist/step-argument-parser.js +11 -1
- package/dist/step-argument-parser.js.map +1 -1
- package/dist/step-attribute-mutations.js +14 -11
- package/dist/step-attribute-mutations.js.map +1 -1
- package/dist/step-collection.d.ts.map +1 -1
- package/dist/step-collection.js +51 -8
- package/dist/step-collection.js.map +1 -1
- package/dist/step-export-types.d.ts +42 -0
- package/dist/step-export-types.d.ts.map +1 -1
- package/dist/step-export-types.js +10 -0
- package/dist/step-export-types.js.map +1 -1
- package/dist/step-exporter.d.ts.map +1 -1
- package/dist/step-exporter.js +9 -1
- package/dist/step-exporter.js.map +1 -1
- package/dist/step-header.d.ts +1 -1
- package/dist/step-header.d.ts.map +1 -1
- package/dist/step-header.js +2 -2
- package/dist/step-header.js.map +1 -1
- package/dist/step-map-unit.d.ts +2 -1
- package/dist/step-map-unit.d.ts.map +1 -1
- package/dist/step-map-unit.js.map +1 -1
- package/dist/step-serialization.d.ts +10 -30
- package/dist/step-serialization.d.ts.map +1 -1
- package/dist/step-serialization.js +10 -60
- package/dist/step-serialization.js.map +1 -1
- package/dist/step-source-iteration.d.ts.map +1 -1
- package/dist/step-source-iteration.js +21 -0
- package/dist/step-source-iteration.js.map +1 -1
- package/dist/style-closure.d.ts +91 -0
- package/dist/style-closure.d.ts.map +1 -0
- package/dist/style-closure.js +164 -0
- package/dist/style-closure.js.map +1 -0
- package/dist/subset-entity-reader.d.ts +104 -0
- package/dist/subset-entity-reader.d.ts.map +1 -0
- package/dist/subset-entity-reader.js +112 -0
- package/dist/subset-entity-reader.js.map +1 -0
- package/dist/subset-roots.d.ts +74 -0
- package/dist/subset-roots.d.ts.map +1 -0
- package/dist/subset-roots.js +168 -0
- package/dist/subset-roots.js.map +1 -0
- package/dist/type-owned-psets.d.ts +19 -0
- package/dist/type-owned-psets.d.ts.map +1 -1
- package/dist/type-owned-psets.js +31 -0
- package/dist/type-owned-psets.js.map +1 -1
- package/dist/unit-normalize.d.ts.map +1 -1
- package/dist/unit-normalize.js +10 -2
- package/dist/unit-normalize.js.map +1 -1
- package/package.json +8 -8
|
@@ -38,6 +38,21 @@
|
|
|
38
38
|
* both from the same token — the source token is the more specific of the
|
|
39
39
|
* two and wins.
|
|
40
40
|
*
|
|
41
|
+
* **Unless the caller NAMED a member** ({@link NAMED_MEMBERS}, #3715). Gate 2
|
|
42
|
+
* as written could not express `IfcLabel` → `IfcText`: both are STRING, so
|
|
43
|
+
* "the two agree" and the source token won, silently discarding the request.
|
|
44
|
+
* The information it was missing is whether the caller CHOSE the type or
|
|
45
|
+
* merely echoed the shape the extractor derived — and that is already in the
|
|
46
|
+
* `PropertyValueType`, because the two are different members of it.
|
|
47
|
+
* `String` / `Real` are SHAPES, which is all the extractor can produce (it
|
|
48
|
+
* collapses `IFCLABEL`, `IFCTEXT` and `IFCIDENTIFIER` to `String` and keeps
|
|
49
|
+
* the token only in `dataType`); `Label` / `Identifier` / `Text` NAME one
|
|
50
|
+
* `IfcValue` member each and no extraction path produces them, so one of
|
|
51
|
+
* those can only have come from a caller who asked for it. A named member is
|
|
52
|
+
* therefore authoritative over the source token; a shape keeps gate 2's
|
|
53
|
+
* precedence, which is what stops a value-only edit — the UI passes `String`
|
|
54
|
+
* — from rewriting a neighbouring `IFCTEXT` as `IFCLABEL` all over again.
|
|
55
|
+
*
|
|
41
56
|
* 3. **The VALUE must be representable in that base.** `serializeTypedMarker`
|
|
42
57
|
* coerces, so without this an `IFCLENGTHMEASURE` carrying a non-numeric
|
|
43
58
|
* value would be written as `IFCLENGTHMEASURE(NaN)`, where the shape-derived
|
|
@@ -103,6 +118,26 @@ import { serializeTypedMarker } from './step-serialization.js';
|
|
|
103
118
|
import { serializePropertyValue } from './property-value-serialization.js';
|
|
104
119
|
/** The SELECT `IfcPropertySingleValue.NominalValue` is declared as. */
|
|
105
120
|
const NOMINAL_VALUE_SELECT = 'IfcValue';
|
|
121
|
+
/**
|
|
122
|
+
* The `IfcValue` member each `PropertyValueType` NAMES OUTRIGHT — as opposed to
|
|
123
|
+
* the shapes (`String`, `Real`, `Integer`, …) an extractor collapses a source
|
|
124
|
+
* token into. See gate 2 in the module docstring: this map is what lets a caller
|
|
125
|
+
* change a property's declared type WITHIN one EXPRESS base (#3715), which the
|
|
126
|
+
* base-agreement rule alone made unexpressible.
|
|
127
|
+
*
|
|
128
|
+
* Only the string family appears, and that is not an omission: these three are
|
|
129
|
+
* the only `PropertyValueType` members that name exactly one `IfcValue` member.
|
|
130
|
+
* There is deliberately no entry for `Real` or `Integer` — `IfcLengthMeasure`,
|
|
131
|
+
* `IfcReal` and every other numeric leaf all collapse to `Real`, so it names
|
|
132
|
+
* nothing and must keep gate 2's "source token wins", which is #2482's whole
|
|
133
|
+
* point. `Enum`, `Reference` and `List` are property CLASSES rather than
|
|
134
|
+
* `NominalValue` tokens and are handled by {@link serializePropertyValue}.
|
|
135
|
+
*/
|
|
136
|
+
const NAMED_MEMBERS = new Map([
|
|
137
|
+
[PropertyValueType.Label, 'IfcLabel'],
|
|
138
|
+
[PropertyValueType.Identifier, 'IfcIdentifier'],
|
|
139
|
+
[PropertyValueType.Text, 'IfcText'],
|
|
140
|
+
]);
|
|
106
141
|
/** UPPERCASE STEP token → `[schema-cased type name, EXPRESS base]`. */
|
|
107
142
|
let nominalValueLeaves = null;
|
|
108
143
|
function lookupNominalValueLeaf(token) {
|
|
@@ -225,6 +260,14 @@ function relaxedMember(name, base) {
|
|
|
225
260
|
export function declaredNominalValueType(value, type, dataType) {
|
|
226
261
|
if (value === null || value === undefined)
|
|
227
262
|
return null;
|
|
263
|
+
// The caller NAMED a member rather than echoing a shape (#3715), so it
|
|
264
|
+
// outranks the source token even inside one EXPRESS base — see gate 2.
|
|
265
|
+
// A non-string value is left exactly where it was: `valueFitsBase` would
|
|
266
|
+
// have rejected it below, and `serializePropertyValue` writes the same
|
|
267
|
+
// token for these three anyway, so this branch changes nothing for it.
|
|
268
|
+
const named = NAMED_MEMBERS.get(type);
|
|
269
|
+
if (named !== undefined)
|
|
270
|
+
return typeof value === 'string' ? named : null;
|
|
228
271
|
if (!dataType)
|
|
229
272
|
return null;
|
|
230
273
|
const leaf = lookupNominalValueLeaf(dataType.trim().toUpperCase());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declared-property-type.js","sourceRoot":"","sources":["../src/declared-property-type.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D
|
|
1
|
+
{"version":3,"file":"declared-property-type.js","sourceRoot":"","sources":["../src/declared-property-type.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C7C,MAAM,UAAU,GAAG,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjD,2EAA2E;IAC3E,6EAA6E;IAC7E,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,KAAe,CAAC;QAAE,OAAO,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjF,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAc,EACd,IAAuB,EACvB,QAA4B;IAE5B,MAAM,QAAQ,GAAG,wBAAwB,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IACjE,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAClE,OAAO,oBAAoB,CAAC,QAAQ,EAAE,KAAkC,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema-derived entity type-set machinery shared by `reference-collector.ts`
|
|
3
|
+
* (visible-only / merged export root classification) and `subset-roots.ts`
|
|
4
|
+
* (anonymized-subset root classification, #2934) — split out of
|
|
5
|
+
* `reference-collector.ts` once both consumers needed the same "walk the
|
|
6
|
+
* schema table and collect every descendant of X" primitive instead of a
|
|
7
|
+
* second, hand-maintained copy. `reference-collector.ts` re-exports
|
|
8
|
+
* `INFRASTRUCTURE_TYPES`, `PRODUCT_TYPES` and `collectDescendantNames` so
|
|
9
|
+
* every existing import path keeps working.
|
|
10
|
+
*/
|
|
11
|
+
import { type IfcEntityInfo } from '@ifc-lite/data';
|
|
12
|
+
/**
|
|
13
|
+
* Entity types that form the shared file infrastructure and must always be
|
|
14
|
+
* included. Exported for `subset-roots.ts` (`getSubsetEntityIds`), which
|
|
15
|
+
* needs the same "always a root" set the `visibleOnly` closure uses — see
|
|
16
|
+
* `reference-collector.ts`'s own doc for why these can never be excluded.
|
|
17
|
+
*/
|
|
18
|
+
export declare const INFRASTRUCTURE_TYPES: Set<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Every IfcProduct subtype in every schema this package can export, derived
|
|
21
|
+
* from `@ifc-lite/data`'s generated entity tables rather than hand-listed.
|
|
22
|
+
*
|
|
23
|
+
* A product type missing from this set is not classified as a product, so under
|
|
24
|
+
* `visibleOnly` it never becomes a root: the element — and the geometry only it
|
|
25
|
+
* references — is silently absent from the exported file even though the user
|
|
26
|
+
* never hid it. The hand-written predecessor was derived from IFC4 + IFC4X3
|
|
27
|
+
* alone and therefore dropped every IFC2X3-only product
|
|
28
|
+
* (`IfcElectricDistributionPoint`, `IfcElectricalElement`,
|
|
29
|
+
* `IfcEquipmentElement`, the edge features, the varying structural actions)
|
|
30
|
+
* from a visible-only export of a legacy model.
|
|
31
|
+
*
|
|
32
|
+
* Deriving it means a schema-table regeneration cannot leave this classifier
|
|
33
|
+
* behind. Spatial structure and infrastructure are matched before this set, so
|
|
34
|
+
* its overlap with `SPATIAL_STRUCTURE_TYPES` is harmless. The `hiddenIds`
|
|
35
|
+
* fallback below still catches types no bundled schema declares.
|
|
36
|
+
*/
|
|
37
|
+
/** Exported for the drift test that diffs it against the schema tables. */
|
|
38
|
+
export declare const PRODUCT_TYPES: ReadonlySet<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Add the upper-cased name of every `ancestor` descendant declared in
|
|
41
|
+
* `table`. Generalised from a product-only `collectProductNames` (#2934) so
|
|
42
|
+
* `subset-roots.ts` can derive `IFC_ROOT_TYPES` — every `IfcRoot` descendant
|
|
43
|
+
* — from the same walk instead of a second, hand-maintained copy; behaviour
|
|
44
|
+
* for the existing `'IfcProduct'` caller (`buildProductTypes`) is unchanged.
|
|
45
|
+
*/
|
|
46
|
+
export declare function collectDescendantNames(table: readonly IfcEntityInfo[], ancestor: string, out: Set<string>): void;
|
|
47
|
+
//# sourceMappingURL=entity-type-sets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-type-sets.d.ts","sourceRoot":"","sources":["../src/entity-type-sets.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,aAgB/B,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,2EAA2E;AAC3E,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,CAAuB,CAAC;AAUtE;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,GACf,IAAI,CAkBN"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Schema-derived entity type-set machinery shared by `reference-collector.ts`
|
|
6
|
+
* (visible-only / merged export root classification) and `subset-roots.ts`
|
|
7
|
+
* (anonymized-subset root classification, #2934) — split out of
|
|
8
|
+
* `reference-collector.ts` once both consumers needed the same "walk the
|
|
9
|
+
* schema table and collect every descendant of X" primitive instead of a
|
|
10
|
+
* second, hand-maintained copy. `reference-collector.ts` re-exports
|
|
11
|
+
* `INFRASTRUCTURE_TYPES`, `PRODUCT_TYPES` and `collectDescendantNames` so
|
|
12
|
+
* every existing import path keeps working.
|
|
13
|
+
*/
|
|
14
|
+
import { ENTITIES_IFC2X3, ENTITIES_IFC4, ENTITIES_IFC4X3, } from '@ifc-lite/data';
|
|
15
|
+
/**
|
|
16
|
+
* Entity types that form the shared file infrastructure and must always be
|
|
17
|
+
* included. Exported for `subset-roots.ts` (`getSubsetEntityIds`), which
|
|
18
|
+
* needs the same "always a root" set the `visibleOnly` closure uses — see
|
|
19
|
+
* `reference-collector.ts`'s own doc for why these can never be excluded.
|
|
20
|
+
*/
|
|
21
|
+
export const INFRASTRUCTURE_TYPES = new Set([
|
|
22
|
+
'IFCOWNERHISTORY',
|
|
23
|
+
'IFCAPPLICATION',
|
|
24
|
+
'IFCPERSON',
|
|
25
|
+
'IFCORGANIZATION',
|
|
26
|
+
'IFCPERSONANDORGANIZATION',
|
|
27
|
+
'IFCUNITASSIGNMENT',
|
|
28
|
+
'IFCSIUNIT',
|
|
29
|
+
'IFCDERIVEDUNIT',
|
|
30
|
+
'IFCDERIVEDUNITELEMENT',
|
|
31
|
+
'IFCCONVERSIONBASEDUNIT',
|
|
32
|
+
'IFCMEASUREWITHUNIT',
|
|
33
|
+
'IFCDIMENSIONALEXPONENTS',
|
|
34
|
+
'IFCMONETARYUNIT',
|
|
35
|
+
'IFCGEOMETRICREPRESENTATIONCONTEXT',
|
|
36
|
+
'IFCGEOMETRICREPRESENTATIONSUBCONTEXT',
|
|
37
|
+
]);
|
|
38
|
+
/**
|
|
39
|
+
* Every IfcProduct subtype in every schema this package can export, derived
|
|
40
|
+
* from `@ifc-lite/data`'s generated entity tables rather than hand-listed.
|
|
41
|
+
*
|
|
42
|
+
* A product type missing from this set is not classified as a product, so under
|
|
43
|
+
* `visibleOnly` it never becomes a root: the element — and the geometry only it
|
|
44
|
+
* references — is silently absent from the exported file even though the user
|
|
45
|
+
* never hid it. The hand-written predecessor was derived from IFC4 + IFC4X3
|
|
46
|
+
* alone and therefore dropped every IFC2X3-only product
|
|
47
|
+
* (`IfcElectricDistributionPoint`, `IfcElectricalElement`,
|
|
48
|
+
* `IfcEquipmentElement`, the edge features, the varying structural actions)
|
|
49
|
+
* from a visible-only export of a legacy model.
|
|
50
|
+
*
|
|
51
|
+
* Deriving it means a schema-table regeneration cannot leave this classifier
|
|
52
|
+
* behind. Spatial structure and infrastructure are matched before this set, so
|
|
53
|
+
* its overlap with `SPATIAL_STRUCTURE_TYPES` is harmless. The `hiddenIds`
|
|
54
|
+
* fallback below still catches types no bundled schema declares.
|
|
55
|
+
*/
|
|
56
|
+
/** Exported for the drift test that diffs it against the schema tables. */
|
|
57
|
+
export const PRODUCT_TYPES = buildProductTypes();
|
|
58
|
+
function buildProductTypes() {
|
|
59
|
+
const products = new Set();
|
|
60
|
+
for (const table of [ENTITIES_IFC2X3, ENTITIES_IFC4, ENTITIES_IFC4X3]) {
|
|
61
|
+
collectDescendantNames(table, 'IfcProduct', products);
|
|
62
|
+
}
|
|
63
|
+
return products;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Add the upper-cased name of every `ancestor` descendant declared in
|
|
67
|
+
* `table`. Generalised from a product-only `collectProductNames` (#2934) so
|
|
68
|
+
* `subset-roots.ts` can derive `IFC_ROOT_TYPES` — every `IfcRoot` descendant
|
|
69
|
+
* — from the same walk instead of a second, hand-maintained copy; behaviour
|
|
70
|
+
* for the existing `'IfcProduct'` caller (`buildProductTypes`) is unchanged.
|
|
71
|
+
*/
|
|
72
|
+
export function collectDescendantNames(table, ancestor, out) {
|
|
73
|
+
const parentOf = new Map();
|
|
74
|
+
for (const entity of table)
|
|
75
|
+
parentOf.set(entity.name, entity.parent);
|
|
76
|
+
for (const entity of table) {
|
|
77
|
+
// The walk starts at the parent, so `ancestor` itself — abstract, and
|
|
78
|
+
// never instantiated — is not added, while every descendant is.
|
|
79
|
+
let cursor = parentOf.get(entity.name) ?? null;
|
|
80
|
+
// Depth-bounded so a malformed table cannot spin here; the deepest IFC
|
|
81
|
+
// inheritance chain is far under this bound.
|
|
82
|
+
for (let depth = 0; cursor !== null && depth < 64; depth++) {
|
|
83
|
+
if (cursor === ancestor) {
|
|
84
|
+
out.add(entity.name.toUpperCase());
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
cursor = parentOf.get(cursor) ?? null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=entity-type-sets.js.map
|
|
@@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AM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;QAC/C,uEAAuE;QACvE,6CAA6C;QAC7C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,IAAI,KAAK,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;YAC3D,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACxB,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;gBACnC,MAAM;YACR,CAAC;YACD,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC;QACxC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rescue `IFCMAPCONVERSION` (+ its `IFCPROJECTEDCRS`) into a STEP export
|
|
3
|
+
* closure that otherwise never reaches it.
|
|
4
|
+
*
|
|
5
|
+
* Split out of `reference-collector.ts` (which already sits at its module
|
|
6
|
+
* size budget) rather than grown in place — see that file's own closure-walk
|
|
7
|
+
* functions (`collectReferencedEntityIds`, `collectStyleEntities`) for the
|
|
8
|
+
* KEY DESIGN this shares: `IfcMapConversion.SourceCRS` points AT the
|
|
9
|
+
* `IfcGeometricRepresentationContext` it converts; nothing points the other
|
|
10
|
+
* way. The context is always a closure root (`INFRASTRUCTURE_TYPES`), but a
|
|
11
|
+
* forward-only closure walk from it never reaches `IfcMapConversion` — so
|
|
12
|
+
* every `visibleOnly` / `subsetEntityIds` STEP export of a georeferenced
|
|
13
|
+
* model silently dropped its `IfcMapConversion`/`IfcProjectedCRS` (grid
|
|
14
|
+
* alignment, EPSG code, vertical datum), and the next tool that opens the
|
|
15
|
+
* export sees an un-georeferenced model at the local origin.
|
|
16
|
+
*/
|
|
17
|
+
import type { IfcSourceBytes } from '@ifc-lite/parser';
|
|
18
|
+
/**
|
|
19
|
+
* Collect `IFCMAPCONVERSION` (and, transitively, the `IFCPROJECTEDCRS` it
|
|
20
|
+
* names) when the closure already contains the `IFCGEOMETRICREPRESENTATIONCONTEXT`
|
|
21
|
+
* it converts.
|
|
22
|
+
*
|
|
23
|
+
* Must be called AFTER `collectReferencedEntityIds` (and, if used,
|
|
24
|
+
* `collectStyleEntities`) so the context is already in the closure. Same
|
|
25
|
+
* reverse-pass shape as `collectStyleEntities` (nothing references a styled
|
|
26
|
+
* item back either), just against `IFCMAPCONVERSION`.
|
|
27
|
+
*
|
|
28
|
+
* `excludeIds` (e.g. `pass.hiddenProductIds` / a subset export's
|
|
29
|
+
* `excludedIds`) is honoured the same way `collectReferencedEntityIds`
|
|
30
|
+
* honours it: an excluded `IfcMapConversion`/`IfcProjectedCRS` — for instance
|
|
31
|
+
* one the anonymize-export "remove georeferencing" option deliberately routed
|
|
32
|
+
* into `excludedIds` via `subset-roots.ts`'s `IDENTIFYING_TYPES` — must stay
|
|
33
|
+
* excluded. Without this check, this reverse pass would resurrect it: its
|
|
34
|
+
* only hook, the geometric representation context, is unconditional
|
|
35
|
+
* infrastructure and stays in the closure regardless of that exclusion.
|
|
36
|
+
*
|
|
37
|
+
* @param closure - The existing closure set (mutated in place)
|
|
38
|
+
* @param source - The original STEP file source buffer
|
|
39
|
+
* @param entityIndex - Full entity index with type info and byType lookup
|
|
40
|
+
* @param excludeIds - Entity IDs to never add, even if they reference the
|
|
41
|
+
* closure (deliberately-excluded ids, e.g. a privacy-scrub target)
|
|
42
|
+
*/
|
|
43
|
+
export declare function collectGeoreferencingEntities(closure: Set<number>, source: Uint8Array | IfcSourceBytes, entityIndex: {
|
|
44
|
+
byId: {
|
|
45
|
+
get(expressId: number): {
|
|
46
|
+
type: string;
|
|
47
|
+
byteOffset: number;
|
|
48
|
+
byteLength: number;
|
|
49
|
+
} | undefined;
|
|
50
|
+
has(expressId: number): boolean;
|
|
51
|
+
refsOf?(expressId: number): readonly number[] | undefined;
|
|
52
|
+
};
|
|
53
|
+
byType: Map<string, number[]>;
|
|
54
|
+
}, excludeIds?: ReadonlySet<number>): void;
|
|
55
|
+
//# sourceMappingURL=georef-closure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"georef-closure.d.ts","sourceRoot":"","sources":["../src/georef-closure.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAiBvD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,MAAM,EAAE,UAAU,GAAG,cAAc,EACnC,WAAW,EAAE;IACX,IAAI,EAAE;QACJ,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,GAAG,SAAS,CAAC;QAC7F,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAChC,MAAM,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;KAC3D,CAAC;IACF,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC/B,EACD,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC/B,IAAI,CAuDN"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { collectRefsInByteRange } from './reference-collector.js';
|
|
5
|
+
/**
|
|
6
|
+
* Every concrete STEP type name an `IfcMapConversion` can be written as.
|
|
7
|
+
* `entityIndex.byType` is keyed by the RAW STEP type name, not resolved to a
|
|
8
|
+
* supertype, so asking for `IFCMAPCONVERSION` alone misses every file
|
|
9
|
+
* written with IFC4X3's concrete subtype `IfcMapConversionScaled` — the same
|
|
10
|
+
* mistake `step-georeferencing.ts`'s `MAP_CONVERSION_STEP_TYPES`,
|
|
11
|
+
* `subset-roots.ts`'s `IDENTIFYING_TYPES`/`COORDINATE_REFERENCE_TYPES`, and
|
|
12
|
+
* `on-demand-georeferencing.ts`'s `GEOREF_TYPES` all guard against (#3243).
|
|
13
|
+
*/
|
|
14
|
+
const MAP_CONVERSION_STEP_TYPES = [
|
|
15
|
+
'IFCMAPCONVERSION',
|
|
16
|
+
'IFCMAPCONVERSIONSCALED',
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Collect `IFCMAPCONVERSION` (and, transitively, the `IFCPROJECTEDCRS` it
|
|
20
|
+
* names) when the closure already contains the `IFCGEOMETRICREPRESENTATIONCONTEXT`
|
|
21
|
+
* it converts.
|
|
22
|
+
*
|
|
23
|
+
* Must be called AFTER `collectReferencedEntityIds` (and, if used,
|
|
24
|
+
* `collectStyleEntities`) so the context is already in the closure. Same
|
|
25
|
+
* reverse-pass shape as `collectStyleEntities` (nothing references a styled
|
|
26
|
+
* item back either), just against `IFCMAPCONVERSION`.
|
|
27
|
+
*
|
|
28
|
+
* `excludeIds` (e.g. `pass.hiddenProductIds` / a subset export's
|
|
29
|
+
* `excludedIds`) is honoured the same way `collectReferencedEntityIds`
|
|
30
|
+
* honours it: an excluded `IfcMapConversion`/`IfcProjectedCRS` — for instance
|
|
31
|
+
* one the anonymize-export "remove georeferencing" option deliberately routed
|
|
32
|
+
* into `excludedIds` via `subset-roots.ts`'s `IDENTIFYING_TYPES` — must stay
|
|
33
|
+
* excluded. Without this check, this reverse pass would resurrect it: its
|
|
34
|
+
* only hook, the geometric representation context, is unconditional
|
|
35
|
+
* infrastructure and stays in the closure regardless of that exclusion.
|
|
36
|
+
*
|
|
37
|
+
* @param closure - The existing closure set (mutated in place)
|
|
38
|
+
* @param source - The original STEP file source buffer
|
|
39
|
+
* @param entityIndex - Full entity index with type info and byType lookup
|
|
40
|
+
* @param excludeIds - Entity IDs to never add, even if they reference the
|
|
41
|
+
* closure (deliberately-excluded ids, e.g. a privacy-scrub target)
|
|
42
|
+
*/
|
|
43
|
+
export function collectGeoreferencingEntities(closure, source, entityIndex, excludeIds) {
|
|
44
|
+
const mapConversionIds = MAP_CONVERSION_STEP_TYPES.flatMap((typeName) => entityIndex.byType.get(typeName) ?? []);
|
|
45
|
+
if (mapConversionIds.length === 0)
|
|
46
|
+
return;
|
|
47
|
+
const queue = [];
|
|
48
|
+
const refsOf = (expressId, ref) => {
|
|
49
|
+
const authored = entityIndex.byId.refsOf?.(expressId);
|
|
50
|
+
if (authored)
|
|
51
|
+
return authored.slice();
|
|
52
|
+
return collectRefsInByteRange(source, ref.byteOffset, ref.byteLength);
|
|
53
|
+
};
|
|
54
|
+
for (const expressId of mapConversionIds) {
|
|
55
|
+
if (closure.has(expressId))
|
|
56
|
+
continue;
|
|
57
|
+
if (excludeIds?.has(expressId))
|
|
58
|
+
continue;
|
|
59
|
+
const entityRef = entityIndex.byId.get(expressId);
|
|
60
|
+
if (!entityRef)
|
|
61
|
+
continue;
|
|
62
|
+
// Check SourceCRS specifically — the geometric representation context
|
|
63
|
+
// IfcMapConversion converts — not "any referenced id". SourceCRS is
|
|
64
|
+
// IfcMapConversion's first attribute, so among the referenced ids other
|
|
65
|
+
// than the entity's own (the byte scan yields the record's own "#N="
|
|
66
|
+
// label first, since `ref.byteOffset` starts there, not after it), it is
|
|
67
|
+
// the first one. Checking "any ref" instead let a closure that already
|
|
68
|
+
// contained IfcProjectedCRS (TargetCRS) — reachable some other way, with
|
|
69
|
+
// the context never in the closure — wrongly rescue IfcMapConversion,
|
|
70
|
+
// and the forward walk below then pulled the context in too.
|
|
71
|
+
const refs = refsOf(expressId, entityRef).filter((id) => id !== expressId);
|
|
72
|
+
const sourceCrs = refs[0];
|
|
73
|
+
if (sourceCrs !== undefined && closure.has(sourceCrs)) {
|
|
74
|
+
closure.add(expressId);
|
|
75
|
+
queue.push(expressId);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Walk forward from the newly added IFCMAPCONVERSION to pull in
|
|
79
|
+
// IFCPROJECTEDCRS (TargetCRS) and its referenced units.
|
|
80
|
+
while (queue.length > 0) {
|
|
81
|
+
const entityId = queue.pop();
|
|
82
|
+
const ref = entityIndex.byId.get(entityId);
|
|
83
|
+
if (!ref)
|
|
84
|
+
continue;
|
|
85
|
+
for (const referencedId of refsOf(entityId, ref)) {
|
|
86
|
+
if (!closure.has(referencedId)
|
|
87
|
+
&& !excludeIds?.has(referencedId)
|
|
88
|
+
&& entityIndex.byId.has(referencedId)) {
|
|
89
|
+
closure.add(referencedId);
|
|
90
|
+
queue.push(referencedId);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=georef-closure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"georef-closure.js","sourceRoot":"","sources":["../src/georef-closure.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAoB/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE;;;;;;;;GAQG;AACH,MAAM,yBAAyB,GAAsB;IACnD,kBAAkB;IAClB,wBAAwB;CACzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAoB,EACpB,MAAmC,EACnC,WAOC,EACD,UAAgC;IAEhC,MAAM,gBAAgB,GAAG,yBAAyB,CAAC,OAAO,CACxD,CAAC,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CACrD,CAAC;IACF,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAE1C,MAA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AAC,EAAE,CAAC;QACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,EAAG,CAAC;QAC9B,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC3C,IAAI,CAAC,GAAG;YAAE,SAAS;QAEnB,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC;YACjD,IACE,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;mBACvB,CAAC,UAAU,EAAE,GAAG,CAAC,YAAY,CAAC;mBAC9B,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,EACrC,CAAC;gBACD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAC1B,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/glb.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glb.d.ts","sourceRoot":"","sources":["../src/glb.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"glb.d.ts","sourceRoot":"","sources":["../src/glb.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGnD;;;GAGG;AAEH,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,GAAG,CAAC;IACV,GAAG,EAAE,UAAU,CAAC;CACjB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,CA8CnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAWtD;AAiBD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAajG;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,QAAQ,EAAE,CAoG9D"}
|
package/dist/glb.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { linearToSrgb } from '@ifc-lite/data';
|
|
4
5
|
export function parseGLB(glb) {
|
|
6
|
+
if (glb.byteLength < 12)
|
|
7
|
+
throw new Error('GLB file too small for header');
|
|
5
8
|
const dv = new DataView(glb.buffer, glb.byteOffset, glb.byteLength);
|
|
6
9
|
const magic = dv.getUint32(0, true);
|
|
7
10
|
if (magic !== 0x46546c67)
|
|
@@ -15,10 +18,24 @@ export function parseGLB(glb) {
|
|
|
15
18
|
let offset = 12;
|
|
16
19
|
let json = null;
|
|
17
20
|
let bin = null;
|
|
18
|
-
|
|
21
|
+
// Bound the walk by the DECLARED (and above, validated <= glb.byteLength)
|
|
22
|
+
// `totalLen`, not the raw buffer length. Using `glb.byteLength` here let a
|
|
23
|
+
// buffer with bytes appended after a legitimate GLB's end (e.g. a phantom
|
|
24
|
+
// chunk with the BIN magic) get parsed as additional real chunks — the
|
|
25
|
+
// last BIN/JSON chunk found wins, so an attacker-appended trailing chunk
|
|
26
|
+
// silently REPLACED the genuine bin/json. The walk now stops at `totalLen`,
|
|
27
|
+
// so such a trailing chunk is ignored rather than adopted; the file itself
|
|
28
|
+
// is not rejected. Each chunk is also checked against `totalLen` so a chunkLen
|
|
29
|
+
// that overruns the declared length throws instead of `subarray` silently
|
|
30
|
+
// clamping to a truncated view (mirrors the guard in the sibling GLB
|
|
31
|
+
// reader, `@ifc-lite/cache`'s `glb.ts`).
|
|
32
|
+
while (offset + 8 <= totalLen) {
|
|
19
33
|
const chunkLen = dv.getUint32(offset, true);
|
|
20
34
|
const chunkType = dv.getUint32(offset + 4, true);
|
|
21
35
|
offset += 8;
|
|
36
|
+
if (offset + chunkLen > totalLen) {
|
|
37
|
+
throw new Error(`GLB chunk extends beyond declared length: offset=${offset} chunkLen=${chunkLen} totalLen=${totalLen}`);
|
|
38
|
+
}
|
|
22
39
|
const chunk = glb.subarray(offset, offset + chunkLen);
|
|
23
40
|
offset += chunkLen;
|
|
24
41
|
if (chunkType === 0x4e4f534a) {
|
|
@@ -113,7 +130,14 @@ export function parseGLBToMeshData(glb) {
|
|
|
113
130
|
!Number.isFinite(a)) {
|
|
114
131
|
return [...DEFAULT_COLOR];
|
|
115
132
|
}
|
|
116
|
-
|
|
133
|
+
// baseColorFactor is linear-light per the glTF 2.0 spec; IFC colours (and
|
|
134
|
+
// the mesh colours MeshData.color feeds the viewer) are sRGB-encoded, and
|
|
135
|
+
// the exporter decodes sRGB into linear on write. Decode back to sRGB here
|
|
136
|
+
// so an export -> re-import round-trip is lossless. Alpha is not a colour
|
|
137
|
+
// channel and is passed through unchanged. Mirrors `@ifc-lite/cache`'s
|
|
138
|
+
// `resolveMaterialColor`, which applies the identical conversion to the
|
|
139
|
+
// other GLB reader in this repo — both call the same `linearToSrgb`.
|
|
140
|
+
return [linearToSrgb(r), linearToSrgb(g), linearToSrgb(b), a];
|
|
117
141
|
};
|
|
118
142
|
const readAccessor = (accessorIndex) => {
|
|
119
143
|
const acc = accessors[accessorIndex];
|
package/dist/glb.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glb.js","sourceRoot":"","sources":["../src/glb.ts"],"names":[],"mappings":"AAAA;;+DAE+D;
|
|
1
|
+
{"version":3,"file":"glb.js","sourceRoot":"","sources":["../src/glb.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAG/D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAY9C,MAAM,UAAU,Q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GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,SAAS;QAEtG,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,KAAqB,CAAC;QACvD,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,KAAqB,CAAC;QACxD,MAAM,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,KAAoB,CAAC;QAEtD,MAAM,SAAS,GAAG,OAAO,IAAI,EAAE,MAAM,EAAE,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1F,GAAG,CAAC,IAAI,CAAC;YACP,SAAS;YACT,SAAS,EAAE,IAAI,YAAY,CAAC,GAAG,CAAC;YAChC,OAAO,EAAE,IAAI,YAAY,CAAC,GAAG,CAAC;YAC9B,OAAO,EAAE,IAAI,WAAW,CAAC,GAAG,CAAC;YAC7B,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC1C,OAAO,EAAE,YAAY;SACtB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classification carrier for the IFC5 (IFCX) exporter (`ifc5-exporter.ts`,
|
|
3
|
+
* split out to stay under the module-size budget).
|
|
4
|
+
*
|
|
5
|
+
* Resolves an entity's `IfcClassificationReference`s (via
|
|
6
|
+
* `IfcRelAssociatesClassification`, including type-level associations) into
|
|
7
|
+
* the `ifclite::classifications` wire shape (`{ system, code, uri?,
|
|
8
|
+
* description? }[]`), the same shape and attribute key
|
|
9
|
+
* `@ifc-lite/collab`'s snapshot layer (`structured-attrs.ts`) already uses
|
|
10
|
+
* for its structured classification branch — so a classified entity reads
|
|
11
|
+
* back the same way whether the IFCX came from this exporter or from a
|
|
12
|
+
* collab snapshot.
|
|
13
|
+
*/
|
|
14
|
+
import type { IfcDataStore } from '@ifc-lite/parser';
|
|
15
|
+
export interface Ifc5ClassificationRef {
|
|
16
|
+
system: string;
|
|
17
|
+
code: string;
|
|
18
|
+
uri?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* `extractClassificationsOnDemand` needs the source STEP buffer plus the
|
|
23
|
+
* `onDemandClassificationMap` built during columnar parsing; an IFCX-sourced
|
|
24
|
+
* `IfcDataStore` (round-tripping an already-IFC5 model) has neither, so this
|
|
25
|
+
* resolves to an empty list there rather than throwing — that input never
|
|
26
|
+
* carried a classification to lose in the first place.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getClassificationsForEntity(dataStore: IfcDataStore, entityId: number): Ifc5ClassificationRef[];
|
|
29
|
+
/**
|
|
30
|
+
* Mutates `attributes` in place with the entity's classifications under
|
|
31
|
+
* `ifclite::classifications` (the exporter's `attributes` record is built
|
|
32
|
+
* incrementally per node, so this mirrors how Name/Description are set
|
|
33
|
+
* directly rather than returned and merged).
|
|
34
|
+
*/
|
|
35
|
+
export declare function addClassificationAttribute(dataStore: IfcDataStore, entityId: number, attributes: Record<string, unknown>): void;
|
|
36
|
+
//# sourceMappingURL=ifc5-classification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ifc5-classification.d.ts","sourceRoot":"","sources":["../src/ifc5-classification.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIrD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,YAAY,EACvB,QAAQ,EAAE,MAAM,GACf,qBAAqB,EAAE,CAqBzB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,YAAY,EACvB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,IAAI,CAGN"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
import { extractClassificationsOnDemand } from '@ifc-lite/parser';
|
|
5
|
+
import { IFCLITE_ATTR } from '@ifc-lite/ifcx';
|
|
6
|
+
/**
|
|
7
|
+
* `extractClassificationsOnDemand` needs the source STEP buffer plus the
|
|
8
|
+
* `onDemandClassificationMap` built during columnar parsing; an IFCX-sourced
|
|
9
|
+
* `IfcDataStore` (round-tripping an already-IFC5 model) has neither, so this
|
|
10
|
+
* resolves to an empty list there rather than throwing — that input never
|
|
11
|
+
* carried a classification to lose in the first place.
|
|
12
|
+
*/
|
|
13
|
+
export function getClassificationsForEntity(dataStore, entityId) {
|
|
14
|
+
const infos = extractClassificationsOnDemand(dataStore, entityId);
|
|
15
|
+
const refs = [];
|
|
16
|
+
for (const info of infos) {
|
|
17
|
+
// A classification with neither a code nor a name carries nothing a
|
|
18
|
+
// reader could show or match against — skip it rather than emit a
|
|
19
|
+
// `{ system, code: '' }` placeholder that looks like real data.
|
|
20
|
+
const code = info.identification || info.name;
|
|
21
|
+
if (!code)
|
|
22
|
+
continue;
|
|
23
|
+
const ref = {
|
|
24
|
+
system: info.system || 'Unknown',
|
|
25
|
+
code,
|
|
26
|
+
};
|
|
27
|
+
if (info.location)
|
|
28
|
+
ref.uri = info.location;
|
|
29
|
+
if (info.description)
|
|
30
|
+
ref.description = info.description;
|
|
31
|
+
refs.push(ref);
|
|
32
|
+
}
|
|
33
|
+
return refs;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Mutates `attributes` in place with the entity's classifications under
|
|
37
|
+
* `ifclite::classifications` (the exporter's `attributes` record is built
|
|
38
|
+
* incrementally per node, so this mirrors how Name/Description are set
|
|
39
|
+
* directly rather than returned and merged).
|
|
40
|
+
*/
|
|
41
|
+
export function addClassificationAttribute(dataStore, entityId, attributes) {
|
|
42
|
+
const classifications = getClassificationsForEntity(dataStore, entityId);
|
|
43
|
+
if (classifications.length > 0)
|
|
44
|
+
attributes[IFCLITE_ATTR.CLASSIFICATIONS] = classifications;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=ifc5-classification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ifc5-classification.js","sourceRoot":"","sources":["../src/ifc5-classification.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAiB/D,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,SAAuB,EACvB,QAAgB;IAEhB,MAAM,KAAK,GAAG,8BAA8B,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClE,MAAM,IAAI,GAA4B,EAAE,CAAC;IAEzC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,oEAAoE;QACpE,kEAAkE;QAClE,gEAAgE;QAChE,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC;QAC9C,IAAI,CAAC,IAAI;YAAE,SAAS;QAEpB,MAAM,GAAG,GAA0B;YACjC,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,SAAS;YAChC,IAAI;SACL,CAAC;QACF,IAAI,IAAI,CAAC,QAAQ;YAAE,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC3C,IAAI,IAAI,CAAC,WAAW;YAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;QACzD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,SAAuB,EACvB,QAAgB,EAChB,UAAmC;IAEnC,MAAM,eAAe,GAAG,2BAA2B,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACzE,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC;QAAE,UAAU,CAAC,YAAY,CAAC,eAAe,CAAC,GAAG,eAAe,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** IFCX node in output, matching the shape `collectRequiredImports` scans. */
|
|
2
|
+
interface IfcxNodeOutputLike {
|
|
3
|
+
attributes?: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
/** Standard IFC5 schema package URIs, keyed by the attribute prefix they provide. */
|
|
6
|
+
export declare const IFCX_SCHEMA_IMPORTS: {
|
|
7
|
+
/** Core IFC: bsi::ifc::class, bsi::ifc::presentation::*, bsi::ifc::material, bsi::ifc::spaceBoundary */
|
|
8
|
+
readonly IFC_CORE: "https://ifcx.dev/@standards.buildingsmart.org/ifc/core/ifc@v5a.ifcx";
|
|
9
|
+
/** IFC properties: bsi::ifc::prop::* */
|
|
10
|
+
readonly IFC_PROP: "https://ifcx.dev/@standards.buildingsmart.org/ifc/core/prop@v5a.ifcx";
|
|
11
|
+
/** OpenUSD geometry: usd::usdgeom::mesh, usd::xformop, usd::usdgeom::visibility */
|
|
12
|
+
readonly USD: "https://ifcx.dev/@openusd.org/usd@v1.ifcx";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Scan data nodes and return the list of standard IFCX import URIs needed
|
|
16
|
+
* for the attribute namespaces actually used.
|
|
17
|
+
*/
|
|
18
|
+
export declare function collectRequiredImports(nodes: IfcxNodeOutputLike[]): {
|
|
19
|
+
uri: string;
|
|
20
|
+
}[];
|
|
21
|
+
/**
|
|
22
|
+
* Generate a deterministic UUID-like string from an expressId.
|
|
23
|
+
* Format: 8-4-4-4-12 hex chars (UUID v4-like but deterministic).
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateUuid(id: number): string;
|
|
26
|
+
/**
|
|
27
|
+
* Convert STEP uppercase type name (e.g. "IFCWALL") to PascalCase class name (e.g. "IfcWall").
|
|
28
|
+
* Uses the IFC type enum lookup for canonical casing (e.g. "IfcRelAggregates", not "Ifcrelaggregates").
|
|
29
|
+
*/
|
|
30
|
+
export declare function stepTypeToClassName(stepType: string): string;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=ifc5-export-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ifc5-export-helpers.d.ts","sourceRoot":"","sources":["../src/ifc5-export-helpers.ts"],"names":[],"mappings":"AAWA,8EAA8E;AAC9E,UAAU,kBAAkB;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,qFAAqF;AACrF,eAAO,MAAM,mBAAmB;IAC9B,wGAAwG;;IAExG,wCAAwC;;IAExC,mFAAmF;;CAE3E,CAAC;AAEX;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAmCrF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAU5D"}
|