@ifc-lite/export 3.0.0 → 3.1.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 +34 -0
- package/dist/anonymize-export.d.ts +60 -0
- package/dist/anonymize-export.d.ts.map +1 -0
- package/dist/anonymize-export.js +117 -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 +312 -0
- package/dist/anonymize-scrub.js.map +1 -0
- package/dist/anonymize-types.d.ts +212 -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 +19 -8
- package/dist/declared-property-type.d.ts.map +1 -1
- package/dist/declared-property-type.js +31 -9
- 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/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/merged-exporter.d.ts +19 -0
- package/dist/merged-exporter.d.ts.map +1 -1
- package/dist/merged-exporter.js +1 -1
- package/dist/merged-exporter.js.map +1 -1
- package/dist/parquet-exporter.d.ts +1 -3
- package/dist/parquet-exporter.d.ts.map +1 -1
- package/dist/parquet-exporter.js +11 -10
- package/dist/parquet-exporter.js.map +1 -1
- package/dist/property-value-serialization.d.ts +54 -0
- package/dist/property-value-serialization.d.ts.map +1 -0
- package/dist/property-value-serialization.js +134 -0
- package/dist/property-value-serialization.js.map +1 -0
- package/dist/reference-collector.d.ts +47 -0
- package/dist/reference-collector.d.ts.map +1 -1
- package/dist/reference-collector.js +88 -156
- 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 +259 -0
- package/dist/related-entities.js.map +1 -0
- package/dist/schema-converter.d.ts.map +1 -1
- package/dist/schema-converter.js +46 -96
- package/dist/schema-converter.js.map +1 -1
- package/dist/source-ref-bounds.d.ts +3 -3
- package/dist/source-ref-bounds.js +3 -3
- package/dist/step-attribute-mutations.d.ts +0 -42
- package/dist/step-attribute-mutations.d.ts.map +1 -1
- package/dist/step-attribute-mutations.js +17 -147
- package/dist/step-attribute-mutations.js.map +1 -1
- package/dist/step-attribute-serializers.d.ts +41 -0
- package/dist/step-attribute-serializers.d.ts.map +1 -0
- package/dist/step-attribute-serializers.js +74 -0
- package/dist/step-attribute-serializers.js.map +1 -0
- package/dist/step-collection.d.ts +2 -2
- package/dist/step-collection.d.ts.map +1 -1
- package/dist/step-collection.js +38 -8
- package/dist/step-collection.js.map +1 -1
- package/dist/step-export-contexts.d.ts +5 -7
- package/dist/step-export-contexts.d.ts.map +1 -1
- package/dist/step-export-contexts.js +6 -7
- package/dist/step-export-contexts.js.map +1 -1
- package/dist/step-export-types.d.ts +27 -0
- package/dist/step-export-types.d.ts.map +1 -1
- package/dist/step-export-types.js.map +1 -1
- package/dist/step-exporter.d.ts +3 -3
- package/dist/step-exporter.js +4 -4
- package/dist/step-exporter.js.map +1 -1
- package/dist/step-geometry-types.d.ts +1 -17
- package/dist/step-geometry-types.d.ts.map +1 -1
- package/dist/step-geometry-types.js +51 -35
- package/dist/step-geometry-types.js.map +1 -1
- package/dist/step-georeferencing.d.ts +0 -10
- package/dist/step-georeferencing.d.ts.map +1 -1
- package/dist/step-georeferencing.js +46 -94
- package/dist/step-georeferencing.js.map +1 -1
- package/dist/step-header.d.ts +11 -1
- package/dist/step-header.d.ts.map +1 -1
- package/dist/step-header.js +2 -9
- package/dist/step-header.js.map +1 -1
- package/dist/step-map-unit.d.ts +90 -0
- package/dist/step-map-unit.d.ts.map +1 -0
- package/dist/step-map-unit.js +277 -0
- package/dist/step-map-unit.js.map +1 -0
- package/dist/step-overlay-attribute-overrides.d.ts +32 -0
- package/dist/step-overlay-attribute-overrides.d.ts.map +1 -0
- package/dist/step-overlay-attribute-overrides.js +83 -0
- package/dist/step-overlay-attribute-overrides.js.map +1 -0
- package/dist/step-overlay-entities.d.ts +3 -3
- package/dist/step-pass-builder.d.ts +4 -3
- package/dist/step-pass-builder.d.ts.map +1 -1
- package/dist/step-pass-builder.js.map +1 -1
- package/dist/step-property-set-collection.d.ts +24 -0
- package/dist/step-property-set-collection.d.ts.map +1 -0
- package/dist/step-property-set-collection.js +286 -0
- package/dist/step-property-set-collection.js.map +1 -0
- package/dist/step-property-set-generators.d.ts +20 -0
- package/dist/step-property-set-generators.d.ts.map +1 -0
- package/dist/step-property-set-generators.js +98 -0
- package/dist/step-property-set-generators.js.map +1 -0
- package/dist/step-property-set-index.d.ts +25 -0
- package/dist/step-property-set-index.d.ts.map +1 -0
- package/dist/step-property-set-index.js +69 -0
- package/dist/step-property-set-index.js.map +1 -0
- package/dist/step-property-set-readers.d.ts +158 -0
- package/dist/step-property-set-readers.d.ts.map +1 -0
- package/dist/step-property-set-readers.js +251 -0
- package/dist/step-property-set-readers.js.map +1 -0
- package/dist/step-property-sets.d.ts +2 -186
- package/dist/step-property-sets.d.ts.map +1 -1
- package/dist/step-property-sets.js +22 -674
- package/dist/step-property-sets.js.map +1 -1
- package/dist/step-serialization.d.ts +17 -51
- package/dist/step-serialization.d.ts.map +1 -1
- package/dist/step-serialization.js +19 -128
- package/dist/step-serialization.js.map +1 -1
- package/dist/step-source-iteration.d.ts +7 -5
- package/dist/step-source-iteration.d.ts.map +1 -1
- package/dist/step-source-iteration.js +3 -3
- package/dist/step-source-iteration.js.map +1 -1
- package/dist/subset-entity-reader.d.ts +103 -0
- package/dist/subset-entity-reader.d.ts.map +1 -0
- package/dist/subset-entity-reader.js +102 -0
- package/dist/subset-entity-reader.js.map +1 -0
- package/dist/subset-roots.d.ts +58 -0
- package/dist/subset-roots.d.ts.map +1 -0
- package/dist/subset-roots.js +103 -0
- package/dist/subset-roots.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map-unit resolution for the georeferencing phase: the `IfcNamedUnit` an
|
|
3
|
+
* `IfcProjectedCRS.MapUnit` points at, and the reuse-or-synthesise decision
|
|
4
|
+
* behind it.
|
|
5
|
+
*
|
|
6
|
+
* Split out of `step-georeferencing.ts` in #3274 rather than grown in place —
|
|
7
|
+
* the question it answers is a different one from "which georeferencing
|
|
8
|
+
* entities does this export write", it has a second caller in
|
|
9
|
+
* `step-property-sets.ts` (property units reach `findLengthUnitReference`
|
|
10
|
+
* through `findUnitId`), and the module-size budget is not a thing to raise.
|
|
11
|
+
*
|
|
12
|
+
* THE RULE THIS MODULE EXISTS TO KEEP: a unit name is compared WHOLE. The
|
|
13
|
+
* defect it was extracted for was a substring test — `normalized.includes('METRE')`
|
|
14
|
+
* — which `MILLIMETRE`, `CENTIMETRE` and `KILOMETRE` all satisfy, so every one
|
|
15
|
+
* of them was written into the file as a plain `.METRE.`. The map unit is the
|
|
16
|
+
* scale of the entire coordinate reference system, so that is a silent 1000x
|
|
17
|
+
* error in the one attribute another team uses to place the model on the
|
|
18
|
+
* earth, and it is invisible in the output: a millimetre request produced
|
|
19
|
+
* bytes identical to a metre request.
|
|
20
|
+
*
|
|
21
|
+
* And a unit this module cannot express is REFUSED, not approximated.
|
|
22
|
+
* `IfcProjectedCRS.MapUnit` is `OPTIONAL IfcNamedUnit` with
|
|
23
|
+
* `IsLengthUnit : NOT(EXISTS(MapUnit)) OR (MapUnit.UnitType = LENGTHUNIT)`, so
|
|
24
|
+
* an absent MapUnit is schema-valid; a MapUnit naming the wrong unit is not
|
|
25
|
+
* merely lossy, it is false, and nothing downstream can tell it from a true
|
|
26
|
+
* one.
|
|
27
|
+
*/
|
|
28
|
+
import type { EffectiveEntityIndex } from './effective-index.js';
|
|
29
|
+
import type { GeorefContext, GeorefLookupContext } from './step-georeferencing.js';
|
|
30
|
+
/**
|
|
31
|
+
* Message for the refusal when a requested map unit is one this exporter
|
|
32
|
+
* cannot express as an `IfcNamedUnit`. `MapUnit` is optional, so it is left
|
|
33
|
+
* absent rather than filled with a unit that is not the one asked for (#3274).
|
|
34
|
+
*/
|
|
35
|
+
export declare function mapUnitUnsupportedWarning(unitName: string): string;
|
|
36
|
+
/** Record a map unit the exporter refused to guess at. */
|
|
37
|
+
export declare function reportMapUnitUnsupported(warnings: string[], unitName: string): void;
|
|
38
|
+
export declare function resolveMapUnitReference(unitName: string, newGeorefLines: string[], effective: EffectiveEntityIndex, ctx: GeorefContext): number | null;
|
|
39
|
+
/**
|
|
40
|
+
* Canonicalize a map-unit label to the spelling the rest of this module
|
|
41
|
+
* compares against: American `METER` to `METRE`, the foot spellings to `FOOT`,
|
|
42
|
+
* the US survey foot to `US SURVEY FOOT`, and an SI prefix kept rather than
|
|
43
|
+
* swallowed. Anything not recognised is returned normalised-but-unchanged, for
|
|
44
|
+
* the caller to REFUSE rather than guess at.
|
|
45
|
+
*
|
|
46
|
+
* The label is NORMALISED and then matched EXACTLY — never substring-matched.
|
|
47
|
+
*
|
|
48
|
+
* What the normalisation accepts:
|
|
49
|
+
* - any case and any separators: `metres`, `Meters`, `MILLI-METRE`;
|
|
50
|
+
* - `METRE` and `METER`, each carrying any `IfcSIPrefix` member;
|
|
51
|
+
* - `FOOT` and `FEET`;
|
|
52
|
+
* - one English plural suffix, stripped once and re-matched exactly;
|
|
53
|
+
* - the US survey foot, glued or separated in any word order.
|
|
54
|
+
*
|
|
55
|
+
* What it REFUSES, by leaving the label alone so `resolveMapUnitReference`
|
|
56
|
+
* returns `null` and `MapUnit` stays `$` with a warning:
|
|
57
|
+
* - a label that merely CONTAINS a unit. `MILLIMETRE`, `CENTIMETRE` and
|
|
58
|
+
* `KILOMETRE` all contain `METRE`, and an `includes('METRE')` test wrote all
|
|
59
|
+
* three into the file as a plain `.METRE.` — a silent 1000x error in the CRS
|
|
60
|
+
* scale (#3274). The foot half of that same test was `includes('FOOT')`, and
|
|
61
|
+
* it was satisfied by `FOOTCANDLE` (an illuminance), `FOOT-POUND` (an
|
|
62
|
+
* energy), `FOOTPRINT`, and by `SQUARE FOOT` and `CUBIC FEET` — an area and
|
|
63
|
+
* a volume written as a LENGTH unit, which is a wrong DIMENSION rather than
|
|
64
|
+
* a wrong magnitude, and no scale factor can be right for it;
|
|
65
|
+
* - a survey foot with no nationality: `SURVEY FOOT`, `CLARKE'S FOOT`,
|
|
66
|
+
* `INDIAN FOOT`, `SEARS FOOT`, `BRITISH FOOT (1936)` are five different
|
|
67
|
+
* ratios, and `includes('FOOT')` gave every one of them the international
|
|
68
|
+
* 0.3048;
|
|
69
|
+
* - `INCH`, `YARD`, `MILE` and anything else this exporter cannot express.
|
|
70
|
+
*
|
|
71
|
+
* Normalising a recognisable spelling onto a table entry is NOT that
|
|
72
|
+
* approximation: the answer is still one exact table hit, so `MILLIMETERS`
|
|
73
|
+
* resolves to `MILLIMETRE` and not to `METRE`.
|
|
74
|
+
*
|
|
75
|
+
* Sibling of `inferMapUnitScaleFromLabel` in
|
|
76
|
+
* packages/parser/src/map-unit-label.ts and `infer_map_unit_scale` in
|
|
77
|
+
* rust/core/src/unit_labels.rs, which apply these same rules on the reading
|
|
78
|
+
* side. This exporter's accepted set is the smaller one — it writes only what
|
|
79
|
+
* it can express as an `IfcNamedUnit` — but no spelling may be accepted here
|
|
80
|
+
* that those refuse, or refused here that those accept as a length.
|
|
81
|
+
*/
|
|
82
|
+
export declare function normalizeMapUnitName(unitName: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* `effective` filters the candidates the same way the georef reads above do:
|
|
85
|
+
* returning a tombstoned unit id hands the caller a `#id` for a line the
|
|
86
|
+
* export never writes. Returning null instead makes `resolveMapUnitReference`
|
|
87
|
+
* synthesise a fresh unit, which is the outcome a deleted unit deserves.
|
|
88
|
+
*/
|
|
89
|
+
export declare function findLengthUnitReference(preferredUnitName: string, effective: EffectiveEntityIndex, ctx: GeorefLookupContext): number | null;
|
|
90
|
+
//# sourceMappingURL=step-map-unit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-map-unit.d.ts","sourceRoot":"","sources":["../src/step-map-unit.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEnF;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,0DAA0D;AAC1D,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAInF;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAwCtJ;AA8FD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAkB7D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,iBAAiB,EAAE,MAAM,EAAE,SAAS,EAAE,oBAAoB,EAAE,GAAG,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,CAwD3I"}
|
|
@@ -0,0 +1,277 @@
|
|
|
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 { toStepReal } from './step-serialization.js';
|
|
5
|
+
/**
|
|
6
|
+
* Message for the refusal when a requested map unit is one this exporter
|
|
7
|
+
* cannot express as an `IfcNamedUnit`. `MapUnit` is optional, so it is left
|
|
8
|
+
* absent rather than filled with a unit that is not the one asked for (#3274).
|
|
9
|
+
*/
|
|
10
|
+
export function mapUnitUnsupportedWarning(unitName) {
|
|
11
|
+
return `Cannot express map unit ${JSON.stringify(unitName)} as an IfcNamedUnit: only metres (with any SI prefix), FOOT and US SURVEY FOOT are supported. IfcProjectedCRS.MapUnit was left unset rather than declared as metres.`;
|
|
12
|
+
}
|
|
13
|
+
/** Record a map unit the exporter refused to guess at. */
|
|
14
|
+
export function reportMapUnitUnsupported(warnings, unitName) {
|
|
15
|
+
const message = mapUnitUnsupportedWarning(unitName);
|
|
16
|
+
warnings.push(message);
|
|
17
|
+
console.warn(`[StepExporter] ${message}`);
|
|
18
|
+
}
|
|
19
|
+
export function resolveMapUnitReference(unitName, newGeorefLines, effective, ctx) {
|
|
20
|
+
const normalized = normalizeMapUnitName(unitName);
|
|
21
|
+
const existing = findLengthUnitReference(normalized, effective, ctx);
|
|
22
|
+
if (existing !== null) {
|
|
23
|
+
return existing;
|
|
24
|
+
}
|
|
25
|
+
// A metre, with or without an SI prefix. `MILLIMETRE` KEEPS its prefix: the
|
|
26
|
+
// map unit is the scale of the entire coordinate reference system, so
|
|
27
|
+
// writing `.METRE.` for a millimetre map is a silent 1000x error in the one
|
|
28
|
+
// attribute another team relies on to place the model (#3274).
|
|
29
|
+
const prefix = siPrefixOf(normalized);
|
|
30
|
+
if (prefix !== undefined) {
|
|
31
|
+
const unitId = ctx.allocateExpressId();
|
|
32
|
+
const prefixToken = prefix === null ? '$' : `.${prefix}.`;
|
|
33
|
+
newGeorefLines.push(`#${unitId}=IFCSIUNIT(*,.LENGTHUNIT.,${prefixToken},.METRE.);`);
|
|
34
|
+
return unitId;
|
|
35
|
+
}
|
|
36
|
+
if (normalized === 'FOOT' || normalized === 'US SURVEY FOOT') {
|
|
37
|
+
const dimId = ctx.allocateExpressId();
|
|
38
|
+
const siUnitId = ctx.allocateExpressId();
|
|
39
|
+
const measureId = ctx.allocateExpressId();
|
|
40
|
+
const convUnitId = ctx.allocateExpressId();
|
|
41
|
+
const factor = normalized === 'US SURVEY FOOT' ? 1200 / 3937 : 0.3048;
|
|
42
|
+
const name = normalized === 'US SURVEY FOOT' ? 'US SURVEY FOOT' : 'FOOT';
|
|
43
|
+
newGeorefLines.push(`#${dimId}=IFCDIMENSIONALEXPONENTS(1,0,0,0,0,0,0);`);
|
|
44
|
+
newGeorefLines.push(`#${siUnitId}=IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.);`);
|
|
45
|
+
newGeorefLines.push(`#${measureId}=IFCMEASUREWITHUNIT(IFCLENGTHMEASURE(${toStepReal(factor)}),#${siUnitId});`);
|
|
46
|
+
newGeorefLines.push(`#${convUnitId}=IFCCONVERSIONBASEDUNIT(#${dimId},.LENGTHUNIT.,'${name}',#${measureId});`);
|
|
47
|
+
return convUnitId;
|
|
48
|
+
}
|
|
49
|
+
// A unit this exporter cannot express. It must NOT claim to be metres: that
|
|
50
|
+
// is the coordinate reference system's scale, and a wrong one is worse than
|
|
51
|
+
// an absent one. `IfcProjectedCRS.MapUnit` is `OPTIONAL IfcNamedUnit`, and
|
|
52
|
+
// the WHERE rule is `NOT(EXISTS(MapUnit)) OR MapUnit.UnitType = LENGTHUNIT`,
|
|
53
|
+
// so omitting it is schema-valid. Refuse, and let the caller say so in
|
|
54
|
+
// `stats.warnings` the way the two map-conversion refusals do (#3274).
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
/** Every `IfcSIPrefix` member, longest first so `MILLI` cannot shadow `MILLIMICRO`-style
|
|
58
|
+
* compounds and `DECA` cannot shadow `DECI`. */
|
|
59
|
+
const SI_PREFIXES = [
|
|
60
|
+
'FEMTO', 'MICRO', 'HECTO', 'CENTI', 'MILLI',
|
|
61
|
+
'EXA', 'PETA', 'TERA', 'GIGA', 'MEGA', 'KILO', 'DECA', 'DECI', 'NANO', 'PICO', 'ATTO',
|
|
62
|
+
];
|
|
63
|
+
/**
|
|
64
|
+
* The `IfcSIPrefix` token for a normalized metre name — `null` for a bare
|
|
65
|
+
* `METRE`, the prefix for a prefixed one, and `undefined` when the name is not
|
|
66
|
+
* a metre at all.
|
|
67
|
+
*
|
|
68
|
+
* Three-valued deliberately: `null` and `undefined` are the two answers a bare
|
|
69
|
+
* boolean would merge, and merging them is the defect — `MILLIMETRE` reaching
|
|
70
|
+
* the "plain metre" arm is exactly what {@link normalizeMapUnitName}'s old
|
|
71
|
+
* `includes('METRE')` test did.
|
|
72
|
+
*/
|
|
73
|
+
function siPrefixOf(normalized) {
|
|
74
|
+
if (normalized === 'METRE')
|
|
75
|
+
return null;
|
|
76
|
+
for (const prefix of SI_PREFIXES) {
|
|
77
|
+
if (normalized === `${prefix}METRE`)
|
|
78
|
+
return prefix;
|
|
79
|
+
}
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
/** Split a map-unit label into upper-cased alphanumeric tokens. */
|
|
83
|
+
function tokenizeUnitLabel(label) {
|
|
84
|
+
return label.toUpperCase().split(/[^A-Z0-9]+/).filter((token) => token.length > 0);
|
|
85
|
+
}
|
|
86
|
+
/** The foot/feet spellings a US-survey qualifier may be attached to. */
|
|
87
|
+
const FOOT_TOKENS = new Set(['FOOT', 'FEET', 'FT']);
|
|
88
|
+
/**
|
|
89
|
+
* Order-insensitive recogniser for the separated US-survey foot spellings —
|
|
90
|
+
* `foot (US survey)`, `SURVEY FEET (US)`, `US survey foot`. The glued
|
|
91
|
+
* spellings (`USSURVEYFOOT`, `FTUS`, …) are in {@link MAP_UNIT_CANONICAL_NAME}
|
|
92
|
+
* and matched exactly there; once an exporter puts separators in, the word
|
|
93
|
+
* order varies and gluing alone cannot see it.
|
|
94
|
+
*
|
|
95
|
+
* Accepts exactly one foot token plus either `US` (or the glued `USSURVEY`)
|
|
96
|
+
* or both `US` and `SURVEY`. A bare `SURVEY FOOT` without `US` is REFUSED:
|
|
97
|
+
* other national survey feet exist and are different ratios — Clarke's foot is
|
|
98
|
+
* 0.3047972654 m, the Indian foot 0.304799514 m — so the qualifier alone does
|
|
99
|
+
* not identify a value. `US FOOT` on its own IS accepted: EPSG 9003 is the
|
|
100
|
+
* only US foot, so the nationality does identify it.
|
|
101
|
+
*
|
|
102
|
+
* The requirement that exactly ONE foot token be present, with nothing else
|
|
103
|
+
* beside the qualifier, is what refuses `SQUARE US SURVEY FOOT` (an area) and
|
|
104
|
+
* `NON-US SURVEY FOOT` (a label that says it is not this unit).
|
|
105
|
+
*
|
|
106
|
+
* Sibling of `isUsSurveyFootTokens` in packages/parser/src/map-unit-label.ts
|
|
107
|
+
* and `is_us_survey_foot_tokens` in rust/core/src/unit_labels.rs — those two
|
|
108
|
+
* answer a metre scale for the georeferencing READER, this one answers the
|
|
109
|
+
* canonical name the STEP writer emits, but the accepted spellings are the
|
|
110
|
+
* same set and must stay the same set.
|
|
111
|
+
*/
|
|
112
|
+
function isUsSurveyFootTokens(tokens) {
|
|
113
|
+
const feet = tokens.filter((token) => FOOT_TOKENS.has(token));
|
|
114
|
+
if (feet.length !== 1)
|
|
115
|
+
return false;
|
|
116
|
+
const rest = tokens.filter((token) => !FOOT_TOKENS.has(token));
|
|
117
|
+
if (rest.length === 1)
|
|
118
|
+
return rest[0] === 'US' || rest[0] === 'USSURVEY';
|
|
119
|
+
return rest.length === 2 && rest.includes('US') && rest.includes('SURVEY');
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Exact-match table from a folded label to the canonical unit name the rest of
|
|
123
|
+
* this module compares against. DERIVED rather than hand-written: the two base
|
|
124
|
+
* spellings crossed with {@link SI_PREFIXES} — the same list {@link siPrefixOf}
|
|
125
|
+
* reads, so the two cannot drift — plus the foot spellings this exporter can
|
|
126
|
+
* write as an `IfcConversionBasedUnit`.
|
|
127
|
+
*
|
|
128
|
+
* A `Map` rather than an object literal so a label like `CONSTRUCTOR` cannot
|
|
129
|
+
* resolve through `Object.prototype`.
|
|
130
|
+
*/
|
|
131
|
+
const MAP_UNIT_CANONICAL_NAME = (() => {
|
|
132
|
+
const table = new Map();
|
|
133
|
+
for (const spelling of ['METRE', 'METER']) {
|
|
134
|
+
table.set(spelling, 'METRE');
|
|
135
|
+
for (const prefix of SI_PREFIXES)
|
|
136
|
+
table.set(`${prefix}${spelling}`, `${prefix}METRE`);
|
|
137
|
+
}
|
|
138
|
+
for (const foot of ['FOOT', 'FEET'])
|
|
139
|
+
table.set(foot, 'FOOT');
|
|
140
|
+
// The US survey foot is a different ratio from the international foot
|
|
141
|
+
// (1200/3937 vs 0.3048) and is spelled several ways in the wild. These are
|
|
142
|
+
// the accepted glued spellings, matched exactly rather than sniffed for; the
|
|
143
|
+
// separated ones go through {@link isUsSurveyFootTokens}.
|
|
144
|
+
for (const alias of ['USSURVEYFOOT', 'USSURVEYFEET', 'USSURVEYFT', 'USFOOT', 'USFEET', 'USFT', 'FTUS']) {
|
|
145
|
+
table.set(alias, 'US SURVEY FOOT');
|
|
146
|
+
}
|
|
147
|
+
return table;
|
|
148
|
+
})();
|
|
149
|
+
/**
|
|
150
|
+
* Canonicalize a map-unit label to the spelling the rest of this module
|
|
151
|
+
* compares against: American `METER` to `METRE`, the foot spellings to `FOOT`,
|
|
152
|
+
* the US survey foot to `US SURVEY FOOT`, and an SI prefix kept rather than
|
|
153
|
+
* swallowed. Anything not recognised is returned normalised-but-unchanged, for
|
|
154
|
+
* the caller to REFUSE rather than guess at.
|
|
155
|
+
*
|
|
156
|
+
* The label is NORMALISED and then matched EXACTLY — never substring-matched.
|
|
157
|
+
*
|
|
158
|
+
* What the normalisation accepts:
|
|
159
|
+
* - any case and any separators: `metres`, `Meters`, `MILLI-METRE`;
|
|
160
|
+
* - `METRE` and `METER`, each carrying any `IfcSIPrefix` member;
|
|
161
|
+
* - `FOOT` and `FEET`;
|
|
162
|
+
* - one English plural suffix, stripped once and re-matched exactly;
|
|
163
|
+
* - the US survey foot, glued or separated in any word order.
|
|
164
|
+
*
|
|
165
|
+
* What it REFUSES, by leaving the label alone so `resolveMapUnitReference`
|
|
166
|
+
* returns `null` and `MapUnit` stays `$` with a warning:
|
|
167
|
+
* - a label that merely CONTAINS a unit. `MILLIMETRE`, `CENTIMETRE` and
|
|
168
|
+
* `KILOMETRE` all contain `METRE`, and an `includes('METRE')` test wrote all
|
|
169
|
+
* three into the file as a plain `.METRE.` — a silent 1000x error in the CRS
|
|
170
|
+
* scale (#3274). The foot half of that same test was `includes('FOOT')`, and
|
|
171
|
+
* it was satisfied by `FOOTCANDLE` (an illuminance), `FOOT-POUND` (an
|
|
172
|
+
* energy), `FOOTPRINT`, and by `SQUARE FOOT` and `CUBIC FEET` — an area and
|
|
173
|
+
* a volume written as a LENGTH unit, which is a wrong DIMENSION rather than
|
|
174
|
+
* a wrong magnitude, and no scale factor can be right for it;
|
|
175
|
+
* - a survey foot with no nationality: `SURVEY FOOT`, `CLARKE'S FOOT`,
|
|
176
|
+
* `INDIAN FOOT`, `SEARS FOOT`, `BRITISH FOOT (1936)` are five different
|
|
177
|
+
* ratios, and `includes('FOOT')` gave every one of them the international
|
|
178
|
+
* 0.3048;
|
|
179
|
+
* - `INCH`, `YARD`, `MILE` and anything else this exporter cannot express.
|
|
180
|
+
*
|
|
181
|
+
* Normalising a recognisable spelling onto a table entry is NOT that
|
|
182
|
+
* approximation: the answer is still one exact table hit, so `MILLIMETERS`
|
|
183
|
+
* resolves to `MILLIMETRE` and not to `METRE`.
|
|
184
|
+
*
|
|
185
|
+
* Sibling of `inferMapUnitScaleFromLabel` in
|
|
186
|
+
* packages/parser/src/map-unit-label.ts and `infer_map_unit_scale` in
|
|
187
|
+
* rust/core/src/unit_labels.rs, which apply these same rules on the reading
|
|
188
|
+
* side. This exporter's accepted set is the smaller one — it writes only what
|
|
189
|
+
* it can express as an `IfcNamedUnit` — but no spelling may be accepted here
|
|
190
|
+
* that those refuse, or refused here that those accept as a length.
|
|
191
|
+
*/
|
|
192
|
+
export function normalizeMapUnitName(unitName) {
|
|
193
|
+
const normalized = unitName.trim().toUpperCase().replace(/\s+/g, ' ');
|
|
194
|
+
const tokens = tokenizeUnitLabel(normalized);
|
|
195
|
+
if (tokens.length === 0)
|
|
196
|
+
return normalized;
|
|
197
|
+
if (isUsSurveyFootTokens(tokens))
|
|
198
|
+
return 'US SURVEY FOOT';
|
|
199
|
+
const key = tokens.join('');
|
|
200
|
+
const exact = MAP_UNIT_CANONICAL_NAME.get(key);
|
|
201
|
+
if (exact !== undefined)
|
|
202
|
+
return exact;
|
|
203
|
+
// One English plural suffix, removed once and re-matched exactly. `ES`
|
|
204
|
+
// covers spellings whose singular is not reachable by dropping a single `S`.
|
|
205
|
+
for (const suffix of ['S', 'ES']) {
|
|
206
|
+
if (!key.endsWith(suffix))
|
|
207
|
+
continue;
|
|
208
|
+
const singular = MAP_UNIT_CANONICAL_NAME.get(key.slice(0, -suffix.length));
|
|
209
|
+
if (singular !== undefined)
|
|
210
|
+
return singular;
|
|
211
|
+
}
|
|
212
|
+
return normalized;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* `effective` filters the candidates the same way the georef reads above do:
|
|
216
|
+
* returning a tombstoned unit id hands the caller a `#id` for a line the
|
|
217
|
+
* export never writes. Returning null instead makes `resolveMapUnitReference`
|
|
218
|
+
* synthesise a fresh unit, which is the outcome a deleted unit deserves.
|
|
219
|
+
*/
|
|
220
|
+
export function findLengthUnitReference(preferredUnitName, effective, ctx) {
|
|
221
|
+
if (!ctx.entityExtractor)
|
|
222
|
+
return null;
|
|
223
|
+
// An empty label is not a unit name, and it is reachable: the caller guards
|
|
224
|
+
// `crs.mapUnit !== undefined`, not `!== ''`, and `normalizeMapUnitName('')`
|
|
225
|
+
// is `''`. Both comparisons below fold a non-string Name attribute to `''`
|
|
226
|
+
// too, so without this an empty MapUnit binds to whichever unit happens to
|
|
227
|
+
// have a malformed name rather than to nothing.
|
|
228
|
+
if (preferredUnitName === '')
|
|
229
|
+
return null;
|
|
230
|
+
// Only source records carry the bytes `extractEntity` reads, so an
|
|
231
|
+
// overlay-created project is skipped rather than shadowing the file's own.
|
|
232
|
+
const projectId = (effective.byType.get('IFCPROJECT') ?? []).find((id) => ctx.dataStore.entityIndex.byId.has(id));
|
|
233
|
+
const projectRef = projectId !== undefined ? ctx.dataStore.entityIndex.byId.get(projectId) : undefined;
|
|
234
|
+
const project = projectRef ? ctx.entityExtractor.extractEntity(projectRef) : null;
|
|
235
|
+
const unitAssignmentId = project?.attributes?.[8];
|
|
236
|
+
if (typeof unitAssignmentId !== 'number' || effective.isDeleted(unitAssignmentId))
|
|
237
|
+
return null;
|
|
238
|
+
const unitAssignmentRef = ctx.dataStore.entityIndex.byId.get(unitAssignmentId);
|
|
239
|
+
const unitAssignment = unitAssignmentRef ? ctx.entityExtractor.extractEntity(unitAssignmentRef) : null;
|
|
240
|
+
const units = unitAssignment?.attributes?.[0];
|
|
241
|
+
if (!Array.isArray(units))
|
|
242
|
+
return null;
|
|
243
|
+
for (const unitId of units) {
|
|
244
|
+
if (typeof unitId !== 'number' || effective.isDeleted(unitId))
|
|
245
|
+
continue;
|
|
246
|
+
const unitRef = ctx.dataStore.entityIndex.byId.get(unitId);
|
|
247
|
+
const unit = unitRef ? ctx.entityExtractor.extractEntity(unitRef) : null;
|
|
248
|
+
if (!unit)
|
|
249
|
+
continue;
|
|
250
|
+
const typeName = unit.type.toUpperCase();
|
|
251
|
+
const attrs = unit.attributes ?? [];
|
|
252
|
+
const unitType = typeof attrs[1] === 'string' ? attrs[1].replace(/\./g, '').toUpperCase() : '';
|
|
253
|
+
if (unitType !== 'LENGTHUNIT')
|
|
254
|
+
continue;
|
|
255
|
+
if (typeName === 'IFCSIUNIT') {
|
|
256
|
+
const prefix = typeof attrs[2] === 'string' ? attrs[2].replace(/\./g, '').toUpperCase() : '';
|
|
257
|
+
const name = typeof attrs[3] === 'string' ? attrs[3].replace(/\./g, '').toUpperCase() : '';
|
|
258
|
+
// The prefix is part of the unit, so it is part of the comparison. The
|
|
259
|
+
// old test asked only whether the preferred name was `METRE` and the
|
|
260
|
+
// file's unit was a metre of any prefix, which both missed a reusable
|
|
261
|
+
// `.MILLI.` unit and would have matched one for a plain-metre request
|
|
262
|
+
// had `combined` been read (#3274).
|
|
263
|
+
const combined = prefix ? `${prefix}${name}` : name;
|
|
264
|
+
if (normalizeMapUnitName(combined) === preferredUnitName) {
|
|
265
|
+
return unitId;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (typeName === 'IFCCONVERSIONBASEDUNIT') {
|
|
269
|
+
const name = typeof attrs[2] === 'string' ? normalizeMapUnitName(attrs[2]) : '';
|
|
270
|
+
if (name === preferredUnitName) {
|
|
271
|
+
return unitId;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=step-map-unit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-map-unit.js","sourceRoot":"","sources":["../src/step-map-unit.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA+B/D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,QAAgB;IACxD,OAAO,2BAA2B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,sKAAsK,CAAC;AACnO,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,wBAAwB,CAAC,QAAkB,EAAE,QAAgB;IAC3E,MAAM,OAAO,GAAG,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IACpD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,CAAC,IAAI,CAAC,kBAAkB,OAAO,EAAE,CAAC,CAAC;AAC5C,CAAC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,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7F,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3F,uEAAuE;YACvE,qEAAqE;YACrE,sEAAsE;YACtE,sEAAsE;YACtE,oCAAoC;YACpC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YACpD,IAAI,oBAAoB,CAAC,QAAQ,CAAC,KAAK,iBAAiB,EAAE,CAAC;gBACzD,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;QAED,IAAI,QAAQ,KAAK,wBAAwB,EAAE,CAAC;YAC1C,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAChF,IAAI,IAAI,KAAK,iBAAiB,EAAE,CAAC;gBAC/B,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply overlay attribute + positional overrides to an OVERLAY-CREATED
|
|
3
|
+
* entity's argument list (#2006) — the sibling of `step-attribute-
|
|
4
|
+
* mutations.ts`'s source-buffer pipeline that shares its two serialize
|
|
5
|
+
* helpers (`step-attribute-serializers.ts`). Split out of
|
|
6
|
+
* `step-attribute-mutations.ts` (#3184).
|
|
7
|
+
*/
|
|
8
|
+
import type { IfcAttributeValue } from '@ifc-lite/parser';
|
|
9
|
+
import type { IfcSchemaVersion } from './schema-converter.js';
|
|
10
|
+
/**
|
|
11
|
+
* Apply overlay attribute + positional overrides to an OVERLAY-CREATED
|
|
12
|
+
* entity's argument list (#2006).
|
|
13
|
+
*
|
|
14
|
+
* Distinct from {@link applyAttributeMutations} / {@link applyPositionalMutations},
|
|
15
|
+
* which rewrite a line read out of the source buffer. Here the whole line is
|
|
16
|
+
* ours: it was serialized moments ago from the creation payload, so the
|
|
17
|
+
* argument list is the authoring payload's, not the file's. That difference
|
|
18
|
+
* is why this PADS — `entity_create` takes whatever positional list the
|
|
19
|
+
* caller passes, so a wall authored with three arguments still has a real
|
|
20
|
+
* `Tag` slot at index 7, and dropping the edit because the payload was short
|
|
21
|
+
* would be the very data loss this fixes. The source-buffer path must not
|
|
22
|
+
* pad: there a short line means a different schema, and growing a record we
|
|
23
|
+
* did not author would corrupt it.
|
|
24
|
+
*
|
|
25
|
+
* Named and positional overrides resolve to a slot index up front and share
|
|
26
|
+
* ONE padding rule. Two padding rules on one record is how the next bug
|
|
27
|
+
* starts, and the argument for padding — the class is fixed at creation time,
|
|
28
|
+
* so a short payload is partial authoring — never depended on which of the
|
|
29
|
+
* two APIs queued the edit.
|
|
30
|
+
*/
|
|
31
|
+
export declare function applyOverlayEntityOverrides(argsText: string, entityType: string, attributeOverrides: Map<string, string> | null, positionalOverrides: Map<number, IfcAttributeValue> | null, schemaVersion: IfcSchemaVersion, onRejected?: (attrName: string, value: string) => void): string;
|
|
32
|
+
//# sourceMappingURL=step-overlay-attribute-overrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-overlay-attribute-overrides.d.ts","sourceRoot":"","sources":["../src/step-overlay-attribute-overrides.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAK1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAC9C,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,IAAI,EAC1D,aAAa,EAAE,gBAAgB,EAC/B,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GACrD,MAAM,CAoER"}
|
|
@@ -0,0 +1,83 @@
|
|
|
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 { getAttributeNamesAcrossSchemas } from '@ifc-lite/parser';
|
|
5
|
+
import { splitTopLevelArgs } from './step-argument-parser.js';
|
|
6
|
+
import { getRealTypedSlots } from './attribute-real-slots.js';
|
|
7
|
+
import { serializeNamedAttribute, serializePositionalOverride } from './step-attribute-serializers.js';
|
|
8
|
+
/**
|
|
9
|
+
* Apply overlay attribute + positional overrides to an OVERLAY-CREATED
|
|
10
|
+
* entity's argument list (#2006).
|
|
11
|
+
*
|
|
12
|
+
* Distinct from {@link applyAttributeMutations} / {@link applyPositionalMutations},
|
|
13
|
+
* which rewrite a line read out of the source buffer. Here the whole line is
|
|
14
|
+
* ours: it was serialized moments ago from the creation payload, so the
|
|
15
|
+
* argument list is the authoring payload's, not the file's. That difference
|
|
16
|
+
* is why this PADS — `entity_create` takes whatever positional list the
|
|
17
|
+
* caller passes, so a wall authored with three arguments still has a real
|
|
18
|
+
* `Tag` slot at index 7, and dropping the edit because the payload was short
|
|
19
|
+
* would be the very data loss this fixes. The source-buffer path must not
|
|
20
|
+
* pad: there a short line means a different schema, and growing a record we
|
|
21
|
+
* did not author would corrupt it.
|
|
22
|
+
*
|
|
23
|
+
* Named and positional overrides resolve to a slot index up front and share
|
|
24
|
+
* ONE padding rule. Two padding rules on one record is how the next bug
|
|
25
|
+
* starts, and the argument for padding — the class is fixed at creation time,
|
|
26
|
+
* so a short payload is partial authoring — never depended on which of the
|
|
27
|
+
* two APIs queued the edit.
|
|
28
|
+
*/
|
|
29
|
+
export function applyOverlayEntityOverrides(argsText, entityType, attributeOverrides, positionalOverrides, schemaVersion, onRejected) {
|
|
30
|
+
const args = argsText.length > 0 ? splitTopLevelArgs(argsText) : [];
|
|
31
|
+
const attrNames = getAttributeNamesAcrossSchemas(entityType);
|
|
32
|
+
const named = [];
|
|
33
|
+
for (const [attrName, value] of attributeOverrides ?? []) {
|
|
34
|
+
const index = attrNames.indexOf(attrName);
|
|
35
|
+
if (index >= 0)
|
|
36
|
+
named.push([index, value]);
|
|
37
|
+
}
|
|
38
|
+
// Grow to the class's FULL declared arity as soon as any override names a
|
|
39
|
+
// declared slot the creation payload never reached. Growing only as far as
|
|
40
|
+
// the edited slot would emit eight arguments for an IfcWall that declares
|
|
41
|
+
// nine: this parser tolerates the truncated record, a schema-validating
|
|
42
|
+
// consumer rejects the file.
|
|
43
|
+
//
|
|
44
|
+
// An index PAST the declared layout is not a slot at all, so it cannot
|
|
45
|
+
// justify growing the record and stays dropped — as does any override on a
|
|
46
|
+
// class neither schema source knows, where there is no arity to grow to.
|
|
47
|
+
let needsPad = named.some(([index]) => index >= args.length);
|
|
48
|
+
if (!needsPad && positionalOverrides) {
|
|
49
|
+
for (const [index] of positionalOverrides) {
|
|
50
|
+
if (index >= args.length && index < attrNames.length) {
|
|
51
|
+
needsPad = true;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (needsPad) {
|
|
57
|
+
while (args.length < attrNames.length)
|
|
58
|
+
args.push('$');
|
|
59
|
+
}
|
|
60
|
+
// Every `named` index is < attrNames.length by construction, and padding
|
|
61
|
+
// has taken args.length to at least that, so each one lands.
|
|
62
|
+
const realSlots = getRealTypedSlots(entityType, schemaVersion);
|
|
63
|
+
for (const [index, value] of named) {
|
|
64
|
+
const serialized = serializeNamedAttribute(entityType, index, value, args[index], realSlots);
|
|
65
|
+
// Overlay-created entities take the same rejection: a non-numeric REAL is
|
|
66
|
+
// invalid STEP whoever authored the record. The slot keeps the `$` this
|
|
67
|
+
// path padded it with, rather than gaining a quoted string.
|
|
68
|
+
if (serialized === null) {
|
|
69
|
+
onRejected?.(attrNames[index] ?? `#${index}`, value);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
args[index] = serialized;
|
|
73
|
+
}
|
|
74
|
+
if (positionalOverrides && positionalOverrides.size > 0) {
|
|
75
|
+
for (const [index, value] of positionalOverrides) {
|
|
76
|
+
if (index < 0 || index >= args.length)
|
|
77
|
+
continue;
|
|
78
|
+
args[index] = serializePositionalOverride(entityType, index, value, args[index], realSlots, schemaVersion);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return args.join(',');
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=step-overlay-attribute-overrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-overlay-attribute-overrides.js","sourceRoot":"","sources":["../src/step-overlay-attribute-overrides.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAW/D,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAGvG;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAgB,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AC,GAAG,CAAC,CAAC;IACxD,CAAC;IAED,yEAAyE;IACzE,6DAA6D;IAC7D,MAAM,SAAS,GAAG,iBAAiB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAC/D,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,uBAAuB,CACxC,UAAU,EACV,KAAK,EACL,KAAK,EACL,IAAI,CAAC,KAAK,CAAC,EACX,SAAS,CACV,CAAC;QACF,0EAA0E;QAC1E,wEAAwE;QACxE,4DAA4D;QAC5D,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;YACxB,UAAU,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;YACrD,SAAS;QACX,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,UAAU,CAAC;IAC3B,CAAC;IAED,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACxD,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,mBAAmB,EAAE,CAAC;YACjD,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,MAAM;gBAAE,SAAS;YAChD,IAAI,CAAC,KAAK,CAAC,GAAG,2BAA2B,CACvC,UAAU,EACV,KAAK,EACL,KAAK,EACL,IAAI,CAAC,KAAK,CAAC,EACX,SAAS,EACT,aAAa,CACd,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
* `step-source-iteration.ts` already injects, not duplicated here.
|
|
22
22
|
* `applyOverlayEntityOverrides` is injected as `OverlayEntitiesContext`'s
|
|
23
23
|
* field even though, since #2475's "remaining private helpers" step, it is
|
|
24
|
-
* an ordinary export of `step-attribute-
|
|
25
|
-
* directly — kept as an injected field for symmetry with the other two and
|
|
24
|
+
* an ordinary export of `step-overlay-attribute-overrides.ts` this file could
|
|
25
|
+
* import directly — kept as an injected field for symmetry with the other two and
|
|
26
26
|
* because `StepExporter.overlayEntitiesContext()` is still the one
|
|
27
27
|
* construction site for this context, exactly as before that step.
|
|
28
28
|
*
|
|
@@ -41,7 +41,7 @@ import type { ExportPass, StepExportOptions } from './step-exporter.js';
|
|
|
41
41
|
*/
|
|
42
42
|
export interface OverlayEntitiesContext {
|
|
43
43
|
readonly mutationView: MutablePropertyView | null;
|
|
44
|
-
/** `step-attribute-
|
|
44
|
+
/** `step-overlay-attribute-overrides.ts`'s `applyOverlayEntityOverrides`: resolves
|
|
45
45
|
* named/positional overrides against the overlay-created entity's
|
|
46
46
|
* EFFECTIVE class. */
|
|
47
47
|
readonly applyOverlayEntityOverrides: (argsText: string, entityType: string, attributeOverrides: Map<string, string> | null, positionalOverrides: Map<number, IfcAttributeValue> | null, schemaVersion: ExportPass['sourceSchema'], onRejected?: (attrName: string, value: string) => void) => string;
|
|
@@ -23,9 +23,10 @@ import type { ExportPass, StepExportOptions } from './step-export-types.js';
|
|
|
23
23
|
/**
|
|
24
24
|
* Everything the pass literal reads that is not its own field.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
* `isGeometryEntity`
|
|
28
|
-
*
|
|
26
|
+
* `dataStore` and `mutationView` are the exporter's, injected rather than
|
|
27
|
+
* reached for. `isGeometryEntity` arrives as a parameter for a different
|
|
28
|
+
* reason: it is the free function in `step-geometry-types.ts`, so taking it
|
|
29
|
+
* here keeps this builder independent of the exporter AND of that module.
|
|
29
30
|
*/
|
|
30
31
|
export interface PassBuildInput {
|
|
31
32
|
readonly dataStore: IfcDataStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-pass-builder.d.ts","sourceRoot":"","sources":["../src/step-pass-builder.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;G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AAM,CAAC;CAC9B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,UAAU,CA2QjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-pass-builder.js","sourceRoot":"","sources":["../src/step-pass-builder.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAyB/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"step-pass-builder.js","sourceRoot":"","sources":["../src/step-pass-builder.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAyB/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAwBnD,MAAM,UAAU,eAAe,CAAC,KAAqB;IACnD,MAAM,EACJ,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,YAAY,EACZ,UAAU,EACV,cAAc,EACd,eAAe,EACf,YAAY,EACZ,WAAW,GACZ,GAAG,KAAK,CAAC;IAEV,MAAM,IAAI,GAAe;QACvB,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,CAAC;QACjB,MAAM;QACN,YAAY;QACZ,UAAU;QACV,YAAY;QACZ,WAAW;QACX,aAAa,EAAE,CAAC,CAAC,YAAY,IAAI,cAAc;QAE/C,4EAA4E;QAC5E,2EAA2E;QAC3E,mEAAmE;QACnE,kEAAkE;QAClE,mEAAmE;QACnE,6CAA6C;QAC7C,WAAW,EAAE,CAAC,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CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;QACtD,CAAC;QAED,yEAAyE;QACzE,0EAA0E;QAC1E,4EAA4E;QAC5E,0EAA0E;QAC1E,WAAW;QACX,aAAa,EAAE,wBAAwB,CAAC,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC;QAEnE;;;;;;WAMG;QACH,eAAe,EAAE;YACf,SAAS,EAAE,IAAI,GAAG,EAAU;YAC5B,cAAc,EAAE,IAAI,GAAG,EAAU;SAClC;QAED,uDAAuD;QACvD,gBAAgB,EAAE,IAAI,GAAG,EAAU;QACnC,kBAAkB,EAAE,IAAI,GAAG,EAA+B;QAC1D,eAAe,EAAE,EAAE;QACnB,eAAe,EAAE,EAAE;QACnB,0BAA0B,EAAE,IAAI,GAAG,EAAuB;QAC1D,wBAAwB,EAAE,IAAI,GAAG,EAAoB;QACrD,kBAAkB,EAAE,IAAI,GAAG,EAAU;QACrC,oBAAoB,EAAE,IAAI,GAAG,EAAkB;QAC/C;6EACqE;QACrE,qBAAqB,EAAE,IAAI,GAAG,EAA6B;QAE3D,sDAAsD;QACtD,kBAAkB,EAAE,IAAI,GAAG,EAAU;QACrC,mBAAmB,EAAE,IAAI,GAAG,EAAU;QAEtC,iEAAiE;QACjE,mEAAmE;QACnE,cAAc,EAAE,EAAE;QAClB,QAAQ,EAAE,EAAE;KACb,CAAC;IACF,sDAAsD;IACtD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type PropertySetContext } from './step-property-set-readers.js';
|
|
2
|
+
import type { ExportPass, StepExportOptions } from './step-exporter.js';
|
|
3
|
+
/** The mutation groupings `export()` builds before the collection phase runs. */
|
|
4
|
+
export interface PropertyMutationGroups {
|
|
5
|
+
readonly entityPropMutations: Map<number, Set<string>>;
|
|
6
|
+
readonly entityQuantMutations: Map<number, Set<string>>;
|
|
7
|
+
readonly relDefinesByEntity: Map<number, Array<{
|
|
8
|
+
relId: number;
|
|
9
|
+
psetId: number;
|
|
10
|
+
}>>;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Collect what the overlay's property-set and quantity-set edits mean for this
|
|
14
|
+
* export: which sets to regenerate (`pass.newPropertySets` /
|
|
15
|
+
* `pass.newQuantitySets`), which source records to withhold
|
|
16
|
+
* (`pass.skipPropertySetIds` / `pass.skipRelationshipIds`), and which type
|
|
17
|
+
* objects need their `HasPropertySets` resolved later
|
|
18
|
+
* (`pass.typeOwnedPsetNamesByEntity`, `…IdsByEntity`, `pass.rewrittenEntityIds`).
|
|
19
|
+
*
|
|
20
|
+
* The caller owns the `mutationView && options.applyMutations !== false` gate;
|
|
21
|
+
* reaching here means overlay edits were both present and enabled.
|
|
22
|
+
*/
|
|
23
|
+
export declare function collectPropertyAndQuantitySetMutations(pass: ExportPass, options: StepExportOptions, groups: PropertyMutationGroups, ctx: PropertySetContext): void;
|
|
24
|
+
//# sourceMappingURL=step-property-set-collection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-property-set-collection.d.ts","sourceRoot":"","sources":["../src/step-property-set-collection.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAExE,iFAAiF;AACjF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACvD,QAAQ,CAAC,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACxD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;CACpF;AAkBD;;;;;;;;;;GAUG;AACH,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,kBAAkB,GACtB,IAAI,CAqQN"}
|