@ifc-lite/ids 3.1.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/audit/coherence/cardinality.js +4 -1
- package/dist/audit/coherence/cardinality.js.map +1 -1
- package/dist/audit/coherence/index.d.ts +0 -1
- package/dist/audit/coherence/index.d.ts.map +1 -1
- package/dist/audit/coherence/index.js +59 -45
- package/dist/audit/coherence/index.js.map +1 -1
- package/dist/audit/coherence/regex.d.ts +3 -3
- package/dist/audit/coherence/regex.js +3 -3
- package/dist/audit/ifc-schema/attribute-value.d.ts +19 -0
- package/dist/audit/ifc-schema/attribute-value.d.ts.map +1 -0
- package/dist/audit/ifc-schema/attribute-value.js +71 -0
- package/dist/audit/ifc-schema/attribute-value.js.map +1 -0
- package/dist/audit/ifc-schema/datatype-check.d.ts +9 -1
- package/dist/audit/ifc-schema/datatype-check.d.ts.map +1 -1
- package/dist/audit/ifc-schema/datatype-check.js +24 -2
- package/dist/audit/ifc-schema/datatype-check.js.map +1 -1
- package/dist/audit/ifc-schema/entity-requirement.d.ts +21 -0
- package/dist/audit/ifc-schema/entity-requirement.d.ts.map +1 -0
- package/dist/audit/ifc-schema/entity-requirement.js +45 -0
- package/dist/audit/ifc-schema/entity-requirement.js.map +1 -0
- package/dist/audit/ifc-schema/index.d.ts.map +1 -1
- package/dist/audit/ifc-schema/index.js +105 -19
- package/dist/audit/ifc-schema/index.js.map +1 -1
- package/dist/audit/index.d.ts.map +1 -1
- package/dist/audit/index.js +8 -2
- package/dist/audit/index.js.map +1 -1
- package/dist/audit/parser-shim.d.ts +15 -1
- package/dist/audit/parser-shim.d.ts.map +1 -1
- package/dist/audit/parser-shim.js +2 -2
- package/dist/audit/parser-shim.js.map +1 -1
- package/dist/audit/structural/index.d.ts +3 -1
- package/dist/audit/structural/index.d.ts.map +1 -1
- package/dist/audit/structural/index.js +48 -179
- package/dist/audit/structural/index.js.map +1 -1
- package/dist/audit/structural/shapes.d.ts +47 -0
- package/dist/audit/structural/shapes.d.ts.map +1 -0
- package/dist/audit/structural/shapes.js +185 -0
- package/dist/audit/structural/shapes.js.map +1 -0
- package/dist/audit/types.d.ts +9 -1
- package/dist/audit/types.d.ts.map +1 -1
- package/dist/audit/xsd/index.js +1 -1
- package/dist/audit/xsd/index.js.map +1 -1
- package/dist/bounded-cache.d.ts +18 -0
- package/dist/bounded-cache.d.ts.map +1 -0
- package/dist/bounded-cache.js +40 -0
- package/dist/bounded-cache.js.map +1 -0
- package/dist/bridge/data-accessor.d.ts.map +1 -1
- package/dist/bridge/data-accessor.js +49 -25
- package/dist/bridge/data-accessor.js.map +1 -1
- package/dist/bridge/index.d.ts +1 -0
- package/dist/bridge/index.d.ts.map +1 -1
- package/dist/bridge/index.js +1 -0
- package/dist/bridge/index.js.map +1 -1
- package/dist/bridge/measure-conversion.d.ts +51 -0
- package/dist/bridge/measure-conversion.d.ts.map +1 -0
- package/dist/bridge/measure-conversion.js +106 -0
- package/dist/bridge/measure-conversion.js.map +1 -0
- package/dist/bridge/predefined-property-sets.d.ts +24 -0
- package/dist/bridge/predefined-property-sets.d.ts.map +1 -0
- package/dist/bridge/predefined-property-sets.js +86 -0
- package/dist/bridge/predefined-property-sets.js.map +1 -0
- package/dist/bridge/predefined-types.d.ts +34 -13
- package/dist/bridge/predefined-types.d.ts.map +1 -1
- package/dist/bridge/predefined-types.js +40 -71
- package/dist/bridge/predefined-types.js.map +1 -1
- package/dist/bridge/project-property.d.ts +43 -0
- package/dist/bridge/project-property.d.ts.map +1 -0
- package/dist/bridge/project-property.js +60 -0
- package/dist/bridge/project-property.js.map +1 -0
- package/dist/bridge/properties.d.ts +4 -3
- package/dist/bridge/properties.d.ts.map +1 -1
- package/dist/bridge/properties.js +64 -111
- package/dist/bridge/properties.js.map +1 -1
- package/dist/bridge/property-overlay-resolver.d.ts +10 -0
- package/dist/bridge/property-overlay-resolver.d.ts.map +1 -1
- package/dist/bridge/property-overlay-resolver.js +53 -4
- package/dist/bridge/property-overlay-resolver.js.map +1 -1
- package/dist/bridge/units.d.ts +49 -20
- package/dist/bridge/units.d.ts.map +1 -1
- package/dist/bridge/units.js +134 -84
- package/dist/bridge/units.js.map +1 -1
- package/dist/constraint-types.d.ts +30 -14
- package/dist/constraint-types.d.ts.map +1 -1
- package/dist/constraints/comparators.d.ts +4 -1
- package/dist/constraints/comparators.d.ts.map +1 -1
- package/dist/constraints/comparators.js +6 -1
- package/dist/constraints/comparators.js.map +1 -1
- package/dist/constraints/describe.d.ts.map +1 -1
- package/dist/constraints/describe.js +67 -21
- package/dist/constraints/describe.js.map +1 -1
- package/dist/constraints/match-bounds.d.ts +25 -0
- package/dist/constraints/match-bounds.d.ts.map +1 -0
- package/dist/constraints/match-bounds.js +112 -0
- package/dist/constraints/match-bounds.js.map +1 -0
- package/dist/constraints/match-family.d.ts.map +1 -1
- package/dist/constraints/match-family.js +25 -90
- package/dist/constraints/match-family.js.map +1 -1
- package/dist/constraints/xsd-datetime.js +6 -6
- package/dist/constraints/xsd-examples.d.ts +20 -0
- package/dist/constraints/xsd-examples.d.ts.map +1 -0
- package/dist/constraints/xsd-examples.js +187 -0
- package/dist/constraints/xsd-examples.js.map +1 -0
- package/dist/constraints/xsd-lexical.d.ts +2 -0
- package/dist/constraints/xsd-lexical.d.ts.map +1 -0
- package/dist/constraints/xsd-lexical.js +49 -0
- package/dist/constraints/xsd-lexical.js.map +1 -0
- package/dist/constraints/xsd-order.d.ts +33 -0
- package/dist/constraints/xsd-order.d.ts.map +1 -0
- package/dist/constraints/xsd-order.js +211 -0
- package/dist/constraints/xsd-order.js.map +1 -0
- package/dist/constraints/xsd-regex-ast.d.ts +37 -0
- package/dist/constraints/xsd-regex-ast.d.ts.map +1 -0
- package/dist/constraints/xsd-regex-ast.js +137 -0
- package/dist/constraints/xsd-regex-ast.js.map +1 -0
- package/dist/constraints/xsd-regex-blocks.d.ts +7 -0
- package/dist/constraints/xsd-regex-blocks.d.ts.map +1 -0
- package/dist/constraints/xsd-regex-blocks.js +68 -0
- package/dist/constraints/xsd-regex-blocks.js.map +1 -0
- package/dist/constraints/xsd-regex.d.ts +2 -45
- package/dist/constraints/xsd-regex.d.ts.map +1 -1
- package/dist/constraints/xsd-regex.js +231 -134
- package/dist/constraints/xsd-regex.js.map +1 -1
- package/dist/facets/entity-facet.d.ts.map +1 -1
- package/dist/facets/entity-facet.js +4 -1
- package/dist/facets/entity-facet.js.map +1 -1
- package/dist/facets/partof-facet.d.ts.map +1 -1
- package/dist/facets/partof-facet.js +80 -19
- package/dist/facets/partof-facet.js.map +1 -1
- package/dist/facets/predefined-type-match.d.ts +8 -3
- package/dist/facets/predefined-type-match.d.ts.map +1 -1
- package/dist/facets/predefined-type-match.js.map +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -1
- package/dist/parser/dom.d.ts +4 -0
- package/dist/parser/dom.d.ts.map +1 -1
- package/dist/parser/dom.js +5 -0
- package/dist/parser/dom.js.map +1 -1
- package/dist/parser/parse-restriction.d.ts.map +1 -1
- package/dist/parser/parse-restriction.js +32 -14
- package/dist/parser/parse-restriction.js.map +1 -1
- package/dist/parser/xml-parser.d.ts +7 -4
- package/dist/parser/xml-parser.d.ts.map +1 -1
- package/dist/parser/xml-parser.js +30 -45
- package/dist/parser/xml-parser.js.map +1 -1
- package/dist/preview/audit.d.ts +16 -0
- package/dist/preview/audit.d.ts.map +1 -0
- package/dist/preview/audit.js +58 -0
- package/dist/preview/audit.js.map +1 -0
- package/dist/preview/features.d.ts +30 -0
- package/dist/preview/features.d.ts.map +1 -0
- package/dist/preview/features.js +96 -0
- package/dist/preview/features.js.map +1 -0
- package/dist/preview/parse-ids11.d.ts +9 -0
- package/dist/preview/parse-ids11.d.ts.map +1 -0
- package/dist/preview/parse-ids11.js +90 -0
- package/dist/preview/parse-ids11.js.map +1 -0
- package/dist/preview/partof-nested.d.ts +27 -0
- package/dist/preview/partof-nested.d.ts.map +1 -0
- package/dist/preview/partof-nested.js +61 -0
- package/dist/preview/partof-nested.js.map +1 -0
- package/dist/preview/tolerance.d.ts +15 -0
- package/dist/preview/tolerance.d.ts.map +1 -0
- package/dist/preview/tolerance.js +66 -0
- package/dist/preview/tolerance.js.map +1 -0
- package/dist/preview/types.d.ts +67 -0
- package/dist/preview/types.d.ts.map +1 -0
- package/dist/preview/types.js +5 -0
- package/dist/preview/types.js.map +1 -0
- package/dist/report-types.d.ts +7 -0
- package/dist/report-types.d.ts.map +1 -1
- package/dist/translation/describe-constraint.js +16 -14
- package/dist/translation/describe-constraint.js.map +1 -1
- package/dist/translation/locales/de.d.ts +2 -0
- package/dist/translation/locales/de.d.ts.map +1 -1
- package/dist/translation/locales/de.js +2 -0
- package/dist/translation/locales/de.js.map +1 -1
- package/dist/translation/locales/en.d.ts +2 -0
- package/dist/translation/locales/en.d.ts.map +1 -1
- package/dist/translation/locales/en.js +2 -0
- package/dist/translation/locales/en.js.map +1 -1
- package/dist/translation/locales/fr.d.ts +2 -0
- package/dist/translation/locales/fr.d.ts.map +1 -1
- package/dist/translation/locales/fr.js +2 -0
- package/dist/translation/locales/fr.js.map +1 -1
- package/dist/translation/locales/index.d.ts +1 -0
- package/dist/translation/locales/index.d.ts.map +1 -1
- package/dist/translation/locales/index.js +1 -0
- package/dist/translation/locales/index.js.map +1 -1
- package/dist/translation/locales/it.d.ts +198 -0
- package/dist/translation/locales/it.d.ts.map +1 -0
- package/dist/translation/locales/it.js +235 -0
- package/dist/translation/locales/it.js.map +1 -0
- package/dist/translation/service.d.ts +2 -6
- package/dist/translation/service.d.ts.map +1 -1
- package/dist/translation/service.js +17 -25
- package/dist/translation/service.js.map +1 -1
- package/dist/types.d.ts +26 -31
- package/dist/types.d.ts.map +1 -1
- package/dist/validation/format-failure-reason.js +1 -1
- package/dist/validation/format-failure-reason.js.map +1 -1
- package/dist/validation/pass-rate.d.ts +14 -0
- package/dist/validation/pass-rate.d.ts.map +1 -0
- package/dist/validation/pass-rate.js +25 -0
- package/dist/validation/pass-rate.js.map +1 -0
- package/dist/validation/prohibited-specification.d.ts +31 -0
- package/dist/validation/prohibited-specification.d.ts.map +1 -0
- package/dist/validation/prohibited-specification.js +25 -0
- package/dist/validation/prohibited-specification.js.map +1 -0
- package/dist/validation/validator.d.ts +4 -2
- package/dist/validation/validator.d.ts.map +1 -1
- package/dist/validation/validator.js +23 -18
- package/dist/validation/validator.js.map +1 -1
- package/dist/writer/constraint.d.ts +8 -0
- package/dist/writer/constraint.d.ts.map +1 -0
- package/dist/writer/constraint.js +142 -0
- package/dist/writer/constraint.js.map +1 -0
- package/dist/writer/index.d.ts +48 -0
- package/dist/writer/index.d.ts.map +1 -0
- package/dist/writer/index.js +209 -0
- package/dist/writer/index.js.map +1 -0
- package/dist/writer/xml-lines.d.ts +17 -0
- package/dist/writer/xml-lines.d.ts.map +1 -0
- package/dist/writer/xml-lines.js +69 -0
- package/dist/writer/xml-lines.js.map +1 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src/bridge/properties.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAEL,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,8BAA8B,EAC9B,
|
|
1
|
+
{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../src/bridge/properties.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D,OAAO,EAEL,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,8BAA8B,EAC9B,sCAAsC,EACtC,0BAA0B,GAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,MAAM,+BA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AAE,CAAC;QACpE,GAAG,CAAC,IAAI,CAAC;YACP,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAY,EAAE,MAAM,CAAC,CAAC;SACtF,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -67,4 +67,14 @@ export type PropertyOverlayResolver = (expressId: number) => PropertyOverride[]
|
|
|
67
67
|
* consumes it in agreement.
|
|
68
68
|
*/
|
|
69
69
|
export declare function resolveEffectivePropertySets(store: IfcDataStore, expressId: number, propertyOverlay: PropertyOverlayResolver | undefined): PropertySetInfo[];
|
|
70
|
+
/**
|
|
71
|
+
* The inverse of what {@link resolveEffectivePropertySets} applies to an
|
|
72
|
+
* override: convert a base-SI value (an IDS literal, or a correction typed to
|
|
73
|
+
* satisfy one) into the raw frame `psetName`.`propName` on `expressId` is
|
|
74
|
+
* stored in — the property's own `Unit` when it declares one, else the
|
|
75
|
+
* project unit for `dataType` (or, when omitted, the property's own
|
|
76
|
+
* dataType). A property the entity does not carry yet takes the project
|
|
77
|
+
* unit, matching how a created override is read back.
|
|
78
|
+
*/
|
|
79
|
+
export declare function propertyValueToRaw(store: IfcDataStore, expressId: number, psetName: string, propName: string, dataType: string | undefined, value: string | number | boolean): string | number | boolean;
|
|
70
80
|
//# sourceMappingURL=property-overlay-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-overlay-resolver.d.ts","sourceRoot":"","sources":["../../src/bridge/property-overlay-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"property-overlay-resolver.d.ts","sourceRoot":"","sources":["../../src/bridge/property-overlay-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAanD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IACxC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,gBAAgB,EAAE,GAAG,SAAS,CAAC;AAE5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,uBAAuB,GAAG,SAAS,GACnD,eAAe,EAAE,CAkInB;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAC/B,MAAM,GAAG,MAAM,GAAG,OAAO,CAgB3B"}
|
|
@@ -1,8 +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 { fromSi, isIdentity, toSi } from './measure-conversion.js';
|
|
4
5
|
import { collectAllPropertySets } from './properties.js';
|
|
5
|
-
import {
|
|
6
|
+
import { copyOwnUnit, ownUnitOf } from './project-property.js';
|
|
7
|
+
import { ownUnitConversionFor, resolveEntityMeasureScales, toBaseSI, toRaw, } from './units.js';
|
|
6
8
|
/**
|
|
7
9
|
* Property sets for `expressId`, with any pending overlay writes applied
|
|
8
10
|
* on top of the canonical (parsed) result. The canonical projection stays
|
|
@@ -45,7 +47,11 @@ export function resolveEffectivePropertySets(store, expressId, propertyOverlay)
|
|
|
45
47
|
// base projection's cached/shared objects are never touched.
|
|
46
48
|
const result = base.map((pset) => ({
|
|
47
49
|
...pset,
|
|
48
|
-
properties: pset.properties.map((p) =>
|
|
50
|
+
properties: pset.properties.map((p) => {
|
|
51
|
+
const copy = { ...p };
|
|
52
|
+
copyOwnUnit(p, copy);
|
|
53
|
+
return copy;
|
|
54
|
+
}),
|
|
49
55
|
}));
|
|
50
56
|
// The overlay's raw values (a `PropertyOverride.value` mirrors whatever
|
|
51
57
|
// was written through `MutablePropertyView.setProperty`, e.g. an IDS
|
|
@@ -101,10 +107,14 @@ export function resolveEffectivePropertySets(store, expressId, propertyOverlay)
|
|
|
101
107
|
// scale: a non-measure property (IFCLABEL, boolean, identifier)
|
|
102
108
|
// has no scale and passes through untouched.
|
|
103
109
|
const existing = targetSet.properties[idx];
|
|
104
|
-
|
|
110
|
+
const replacement = {
|
|
105
111
|
...existing,
|
|
106
|
-
value:
|
|
112
|
+
value: existingToBaseSI(existing, override.value, scales),
|
|
107
113
|
};
|
|
114
|
+
// Keep its own Unit so a later override of the same property in this
|
|
115
|
+
// array converts in that unit too.
|
|
116
|
+
copyOwnUnit(existing, replacement);
|
|
117
|
+
targetSet.properties[idx] = replacement;
|
|
108
118
|
}
|
|
109
119
|
else if (matchingSets.length > 0) {
|
|
110
120
|
// No same-named set carries this property yet — a PROPERTY_MISSING
|
|
@@ -153,4 +163,43 @@ export function resolveEffectivePropertySets(store, expressId, propertyOverlay)
|
|
|
153
163
|
}
|
|
154
164
|
return result;
|
|
155
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* An override of an EXISTING property is written in that property's raw
|
|
168
|
+
* frame: its own `Unit` when it declares one (#7395), else the project's.
|
|
169
|
+
*/
|
|
170
|
+
function existingToBaseSI(existing, value, scales) {
|
|
171
|
+
const own = ownUnitOf(existing);
|
|
172
|
+
if (!own)
|
|
173
|
+
return toBaseSI(value, existing.dataType, scales);
|
|
174
|
+
const c = ownUnitConversionFor(existing.dataType, own.siScale, own.symbol, own.siOffset);
|
|
175
|
+
return typeof value === 'number' && !isIdentity(c) ? toSi(value, c) : value;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* The inverse of what {@link resolveEffectivePropertySets} applies to an
|
|
179
|
+
* override: convert a base-SI value (an IDS literal, or a correction typed to
|
|
180
|
+
* satisfy one) into the raw frame `psetName`.`propName` on `expressId` is
|
|
181
|
+
* stored in — the property's own `Unit` when it declares one, else the
|
|
182
|
+
* project unit for `dataType` (or, when omitted, the property's own
|
|
183
|
+
* dataType). A property the entity does not carry yet takes the project
|
|
184
|
+
* unit, matching how a created override is read back.
|
|
185
|
+
*/
|
|
186
|
+
export function propertyValueToRaw(store, expressId, psetName, propName, dataType, value) {
|
|
187
|
+
const psetLower = psetName.toLowerCase();
|
|
188
|
+
const propLower = propName.toLowerCase();
|
|
189
|
+
let existing;
|
|
190
|
+
for (const pset of collectAllPropertySets(store, expressId)) {
|
|
191
|
+
if (pset.name.toLowerCase() !== psetLower)
|
|
192
|
+
continue;
|
|
193
|
+
existing = pset.properties.find((p) => p.name.toLowerCase() === propLower);
|
|
194
|
+
if (existing)
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
const effectiveType = dataType ?? existing?.dataType;
|
|
198
|
+
const own = existing && ownUnitOf(existing);
|
|
199
|
+
if (own) {
|
|
200
|
+
const c = ownUnitConversionFor(effectiveType, own.siScale, own.symbol, own.siOffset);
|
|
201
|
+
return typeof value === 'number' && !isIdentity(c) ? fromSi(value, c) : value;
|
|
202
|
+
}
|
|
203
|
+
return toRaw(value, effectiveType, resolveEntityMeasureScales(store, expressId));
|
|
204
|
+
}
|
|
156
205
|
//# sourceMappingURL=property-overlay-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"property-overlay-resolver.js","sourceRoot":"","sources":["../../src/bridge/property-overlay-resolver.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAM/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"property-overlay-resolver.js","sourceRoot":"","sources":["../../src/bridge/property-overlay-resolver.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAM/D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,QAAQ,EACR,KAAK,GAEN,MAAM,YAAY,CAAC;AAqCpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,4BAA4B,CAC1C,KAAmB,EACnB,SAAiB,EACjB,eAAoD;IAEpD,MAAM,IAAI,GAAG,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC,SAAS,CAAC,CAAC;IAC/C,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEtD,yEAAyE;IACzE,6DAA6D;IAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACjC,GAAG,IAA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,EAAE,CAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACjF,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,EAAE,aAAa,EAAE,0BAA0B,CAAC,KAAK,EAAE,SAAS,CAAC,CAA8B,CAAC;AAChH,CAAC"}
|
package/dist/bridge/units.d.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { type IfcDataStore } from '@ifc-lite/parser';
|
|
1
|
+
import { type IfcDataStore, type ProjectUnits } from '@ifc-lite/parser';
|
|
2
|
+
import { type SiConversion } from './measure-conversion.js';
|
|
2
3
|
/**
|
|
3
4
|
* Per IDS spec, IDS literal values for IFC measure types are always in
|
|
4
5
|
* base SI units. The IFC store keeps the raw author value, so when the
|
|
5
6
|
* project's length unit is `MILLI`, a stored `1000` length means
|
|
6
7
|
* `1.0 metre` and the IDS check `1` should match. This helper applies
|
|
7
8
|
* the project's `lengthUnitScale` to numeric values for length
|
|
8
|
-
* measures,
|
|
9
|
+
* measures, the analogous area/volume scale to area/volume measures, and
|
|
10
|
+
* the declared project unit to every other dimensioned measure (angle,
|
|
11
|
+
* temperature, mass, time, force, power, ...; see measure-conversion.ts).
|
|
9
12
|
*
|
|
10
|
-
* Properties without
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* Properties without one shared dataType (an `IfcPropertyTableValue`, where
|
|
14
|
+
* columns mix labels and measures, or a list mixing types) convert each
|
|
15
|
+
* member by its own type when the parser reports it (`valueDataTypes`).
|
|
16
|
+
* Only a source that does not (the prebuilt property table of a
|
|
17
|
+
* server-parsed store) keeps the old conservative double-up: every numeric
|
|
18
|
+
* candidate is surfaced both raw and length-scaled.
|
|
16
19
|
*/
|
|
17
20
|
/**
|
|
18
21
|
* Declared AREAUNIT / VOLUMEUNIT scale for a project, when explicitly
|
|
@@ -27,6 +30,10 @@ import { type IfcDataStore } from '@ifc-lite/parser';
|
|
|
27
30
|
export interface MeasureScales {
|
|
28
31
|
area?: number;
|
|
29
32
|
volume?: number;
|
|
33
|
+
/** The project's declared units, for measures outside the length family. */
|
|
34
|
+
units?: ProjectUnits;
|
|
35
|
+
/** File-wide units, for a measure `units` leaves undeclared (a project without its own LENGTHUNIT). */
|
|
36
|
+
fallbackUnits?: ProjectUnits;
|
|
30
37
|
}
|
|
31
38
|
/**
|
|
32
39
|
* Resolve the file-declared area/volume scale for `store`, reusing the
|
|
@@ -70,24 +77,21 @@ export interface EntityMeasureScales extends MeasureScales {
|
|
|
70
77
|
*/
|
|
71
78
|
export declare function resolveEntityMeasureScales(store: IfcDataStore, expressId: number): EntityMeasureScales;
|
|
72
79
|
/**
|
|
73
|
-
* The raw-to-
|
|
74
|
-
* the
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* exponent; see `resolveMeasureScales` above). `undefined` for a
|
|
80
|
-
* non-measure `dataType` or when the entity has no resolved length scale.
|
|
80
|
+
* The raw-to-SI conversion for a value of `dataType` held in the project's
|
|
81
|
+
* units: the length family through {@link lengthFamilyScale}, every other
|
|
82
|
+
* dimensioned measure through its declared project unit. The single
|
|
83
|
+
* classification the base projection, an overlay correction and a
|
|
84
|
+
* correction write all key off, so "which measures convert, and how" can't
|
|
85
|
+
* drift between them.
|
|
81
86
|
*/
|
|
82
|
-
export declare function
|
|
87
|
+
export declare function measureConversionFor(dataType: string | undefined, scales: EntityMeasureScales): SiConversion | undefined;
|
|
83
88
|
/**
|
|
84
89
|
* Convert a raw-frame scalar value — the frame every stored IFC property,
|
|
85
90
|
* and every `MutablePropertyView` property mutation, is written in — into
|
|
86
91
|
* the base-SI frame `applyUnitConversion`/`projectProperty` already put
|
|
87
92
|
* every OTHER property of the same pset into. Only numeric measure values
|
|
88
93
|
* move; strings, booleans and non-measure dataTypes pass through
|
|
89
|
-
* unchanged, and a value
|
|
90
|
-
* is returned as-is rather than re-boxed.
|
|
94
|
+
* unchanged, and a value already in SI is returned as-is.
|
|
91
95
|
*/
|
|
92
96
|
export declare function toBaseSI(rawValue: string | number | boolean | null, dataType: string | undefined, scales: EntityMeasureScales): string | number | boolean | null;
|
|
93
97
|
/**
|
|
@@ -96,7 +100,32 @@ export declare function toBaseSI(rawValue: string | number | boolean | null, dat
|
|
|
96
100
|
* frame the model actually stores. Only numeric measure values move.
|
|
97
101
|
*/
|
|
98
102
|
export declare function toRaw(baseSIValue: string | number | boolean | null, dataType: string | undefined, scales: EntityMeasureScales): string | number | boolean | null;
|
|
99
|
-
|
|
103
|
+
/**
|
|
104
|
+
* The conversion for a value whose property or quantity declares its OWN
|
|
105
|
+
* `Unit`. `siScale` is the parser's resolved SI factor of that unit
|
|
106
|
+
* (`unitSiScale` / `explicitUnitSiScale`), `symbol` its display symbol, `siOffset` its °F offset;
|
|
107
|
+
* an unresolved factor, a non-measure dataType or a monetary value (not an
|
|
108
|
+
* SI quantity) gives `undefined`: the value stays as written.
|
|
109
|
+
*/
|
|
110
|
+
export declare function ownUnitConversionFor(dataType: string | undefined, siScale: number | undefined, symbol: string | undefined, siOffset?: number): SiConversion | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Convert a value whose property or quantity declares its OWN `Unit` into
|
|
113
|
+
* SI. IFC uses that `Unit` precisely to let one value depart from the
|
|
114
|
+
* project's unit assignment, so the project factor must not be applied to
|
|
115
|
+
* it (#7395). A unit that is present but could not be read leaves the value
|
|
116
|
+
* raw rather than silently rescaled by the project factor.
|
|
117
|
+
*/
|
|
118
|
+
export declare function applyOwnUnitConversion(rawValue: string | number | boolean | null, rawValues: string[] | undefined, dataType: string | undefined, siScale: number | undefined, symbol?: string, valueDataTypes?: ReadonlyArray<string | undefined>, siOffset?: number): {
|
|
119
|
+
value: string | number | boolean | null;
|
|
120
|
+
values: string[] | undefined;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Convert a value held in the project's units into SI. A multi-valued
|
|
124
|
+
* property without a shared `dataType` converts each member by its own
|
|
125
|
+
* type (`valueDataTypes`, index-aligned with `rawValues`); without those
|
|
126
|
+
* types, see the module doc's legacy double-up.
|
|
127
|
+
*/
|
|
128
|
+
export declare function applyUnitConversion(rawValue: string | number | boolean | null, rawValues: string[] | undefined, dataType: string | undefined, scale: number | undefined, measureScales?: MeasureScales, valueDataTypes?: ReadonlyArray<string | undefined>): {
|
|
100
129
|
value: string | number | boolean | null;
|
|
101
130
|
values: string[] | undefined;
|
|
102
131
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src/bridge/units.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAE1B
|
|
1
|
+
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../src/bridge/units.ts"],"names":[],"mappings":"AAIA,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,YAAY,EAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EASL,KAAK,YAAY,EAClB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,uGAAuG;IACvG,aAAa,CAAC,EAAE,YAAY,CAAC;CAC9B;AAsBD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa,CAYvE;AAED;mFACmF;AACnF,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAID;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,GAChB,mBAAmB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E,MAAM,EAAE,GAAG,SAAS,CAAA;CAAE,CAO3E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,EAC1C,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,EAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,aAAa,CAAC,EAAE,aAAa,EAC7B,cAAc,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,GACjD;IAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;CAAE,CA0B3E"}
|
package/dist/bridge/units.js
CHANGED
|
@@ -2,7 +2,22 @@
|
|
|
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
4
|
import { extractLengthUnitScale, extractProjectUnits, resolveOwningIfcProjectId, } from '@ifc-lite/parser';
|
|
5
|
+
import { convertNumeric, convertTypedMembers, fromSi, isIdentity, lengthFamilyKind, projectUnitConversion, toSi, unitConversion, } from './measure-conversion.js';
|
|
5
6
|
const projectUnitsCache = new WeakMap();
|
|
7
|
+
/**
|
|
8
|
+
* The declared AREAUNIT/VOLUMEUNIT scale of `units`. One that is declared but
|
|
9
|
+
* cannot be resolved (`unitForMeasure` null) gives 1: the value stays
|
|
10
|
+
* unconverted, as `projectUnitConversion` does for other measures, rather
|
|
11
|
+
* than being derived from the length scale or taken from another project.
|
|
12
|
+
* `otherwise` answers a unit that is not declared at all.
|
|
13
|
+
*/
|
|
14
|
+
function declaredScale(units, unitType, otherwise) {
|
|
15
|
+
const resolved = units.resolvedForUnitType(unitType)?.siScale;
|
|
16
|
+
if (resolved !== undefined)
|
|
17
|
+
return resolved;
|
|
18
|
+
const measure = unitType === 'AREAUNIT' ? 'IFCAREAMEASURE' : 'IFCVOLUMEMEASURE';
|
|
19
|
+
return units.unitForMeasure(measure) === null ? 1 : otherwise;
|
|
20
|
+
}
|
|
6
21
|
/**
|
|
7
22
|
* Resolve the file-declared area/volume scale for `store`, reusing the
|
|
8
23
|
* canonical `ProjectUnits` resolver (`@ifc-lite/parser`, mirror of
|
|
@@ -23,8 +38,9 @@ export function resolveMeasureScales(store) {
|
|
|
23
38
|
projectUnitsCache.set(store, units);
|
|
24
39
|
}
|
|
25
40
|
return {
|
|
26
|
-
area: units
|
|
27
|
-
volume: units
|
|
41
|
+
area: declaredScale(units, 'AREAUNIT', undefined),
|
|
42
|
+
volume: declaredScale(units, 'VOLUMEUNIT', undefined),
|
|
43
|
+
units,
|
|
28
44
|
};
|
|
29
45
|
}
|
|
30
46
|
const entityProjectScaleCache = new WeakMap();
|
|
@@ -92,7 +108,19 @@ export function resolveEntityMeasureScales(store, expressId) {
|
|
|
92
108
|
// area/volume scale, which IFC does not require to be related by that
|
|
93
109
|
// exponent (see the module doc above). Take the file-wide answer for
|
|
94
110
|
// all three together, matching the walk-failed fallback exactly.
|
|
95
|
-
|
|
111
|
+
// A measure outside the length family still takes the owner's own
|
|
112
|
+
// declared unit (a project may declare grams without a LENGTHUNIT);
|
|
113
|
+
// only one the owner leaves undeclared takes the file-wide unit.
|
|
114
|
+
// An owner's own AREAUNIT/VOLUMEUNIT still wins over the file-wide one,
|
|
115
|
+
// and one it declares but cannot resolve leaves the value unconverted.
|
|
116
|
+
const fileWide = fallback();
|
|
117
|
+
scales = {
|
|
118
|
+
...fileWide,
|
|
119
|
+
area: declaredScale(units, 'AREAUNIT', fileWide.area),
|
|
120
|
+
volume: declaredScale(units, 'VOLUMEUNIT', fileWide.volume),
|
|
121
|
+
units,
|
|
122
|
+
fallbackUnits: fileWide.units,
|
|
123
|
+
};
|
|
96
124
|
byProject.set(ownerId, scales);
|
|
97
125
|
return scales;
|
|
98
126
|
}
|
|
@@ -105,43 +133,27 @@ export function resolveEntityMeasureScales(store, expressId) {
|
|
|
105
133
|
// length-unit-resolvers-agreement.test.ts).
|
|
106
134
|
scales = {
|
|
107
135
|
length: extractLengthUnitScale(store.source, store.entityIndex, ownerId),
|
|
108
|
-
area: units
|
|
109
|
-
volume: units
|
|
136
|
+
area: declaredScale(units, 'AREAUNIT', undefined),
|
|
137
|
+
volume: declaredScale(units, 'VOLUMEUNIT', undefined),
|
|
138
|
+
units,
|
|
110
139
|
};
|
|
111
140
|
byProject.set(ownerId, scales);
|
|
112
141
|
}
|
|
113
142
|
return scales;
|
|
114
143
|
}
|
|
115
144
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* an untyped table column). The single classification both
|
|
119
|
-
* `applyUnitConversion` and the raw/base-SI helpers below key off, so
|
|
120
|
-
* "which measure types get scaled" can't drift between the base
|
|
121
|
-
* projection and an overlay correction.
|
|
122
|
-
*/
|
|
123
|
-
function measureKind(dataType) {
|
|
124
|
-
const upper = dataType ? dataType.toUpperCase() : '';
|
|
125
|
-
if (upper === 'IFCLENGTHMEASURE' || upper === 'IFCPOSITIVELENGTHMEASURE')
|
|
126
|
-
return 'length';
|
|
127
|
-
if (upper === 'IFCAREAMEASURE')
|
|
128
|
-
return 'area';
|
|
129
|
-
if (upper === 'IFCVOLUMEMEASURE')
|
|
130
|
-
return 'volume';
|
|
131
|
-
return undefined;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* The raw-to-base-SI multiplier for a scalar measure of `dataType`, given
|
|
135
|
-
* the entity's resolved {@link EntityMeasureScales}. Area scales by the
|
|
145
|
+
* The raw-to-base-SI multiplier for a length-family measure of `dataType`,
|
|
146
|
+
* given the entity's resolved {@link EntityMeasureScales}. Area scales by the
|
|
136
147
|
* SQUARE of the length factor and volume by the CUBE (a millimetre-authored
|
|
137
148
|
* 1 m² is stored as 1e6 mm², not 1e3) — NOT the raw length scale — unless
|
|
138
149
|
* the file declares an explicit AREAUNIT/VOLUMEUNIT, which takes
|
|
139
150
|
* precedence (IFC does not require it to relate to LENGTHUNIT by that
|
|
140
151
|
* exponent; see `resolveMeasureScales` above). `undefined` for a
|
|
141
|
-
*
|
|
152
|
+
* measure outside the length family or when the entity has no resolved
|
|
153
|
+
* length scale.
|
|
142
154
|
*/
|
|
143
|
-
|
|
144
|
-
const kind =
|
|
155
|
+
function lengthFamilyScale(dataType, scales) {
|
|
156
|
+
const kind = lengthFamilyKind(dataType);
|
|
145
157
|
if (!kind)
|
|
146
158
|
return undefined;
|
|
147
159
|
if (kind === 'length')
|
|
@@ -151,22 +163,33 @@ export function measureScaleFor(dataType, scales) {
|
|
|
151
163
|
}
|
|
152
164
|
return scales.volume ?? (scales.length != null ? scales.length ** 3 : undefined);
|
|
153
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* The raw-to-SI conversion for a value of `dataType` held in the project's
|
|
168
|
+
* units: the length family through {@link lengthFamilyScale}, every other
|
|
169
|
+
* dimensioned measure through its declared project unit. The single
|
|
170
|
+
* classification the base projection, an overlay correction and a
|
|
171
|
+
* correction write all key off, so "which measures convert, and how" can't
|
|
172
|
+
* drift between them.
|
|
173
|
+
*/
|
|
174
|
+
export function measureConversionFor(dataType, scales) {
|
|
175
|
+
const scale = lengthFamilyScale(dataType, scales);
|
|
176
|
+
if (scale !== undefined)
|
|
177
|
+
return scale ? { scale, offset: 0 } : undefined;
|
|
178
|
+
return projectUnitConversion(dataType, scales.units, scales.fallbackUnits);
|
|
179
|
+
}
|
|
154
180
|
/**
|
|
155
181
|
* Convert a raw-frame scalar value — the frame every stored IFC property,
|
|
156
182
|
* and every `MutablePropertyView` property mutation, is written in — into
|
|
157
183
|
* the base-SI frame `applyUnitConversion`/`projectProperty` already put
|
|
158
184
|
* every OTHER property of the same pset into. Only numeric measure values
|
|
159
185
|
* move; strings, booleans and non-measure dataTypes pass through
|
|
160
|
-
* unchanged, and a value
|
|
161
|
-
* is returned as-is rather than re-boxed.
|
|
186
|
+
* unchanged, and a value already in SI is returned as-is.
|
|
162
187
|
*/
|
|
163
188
|
export function toBaseSI(rawValue, dataType, scales) {
|
|
164
189
|
if (typeof rawValue !== 'number')
|
|
165
190
|
return rawValue;
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
return rawValue;
|
|
169
|
-
return rawValue * scale;
|
|
191
|
+
const c = measureConversionFor(dataType, scales);
|
|
192
|
+
return isIdentity(c) ? rawValue : toSi(rawValue, c);
|
|
170
193
|
}
|
|
171
194
|
/**
|
|
172
195
|
* The inverse of {@link toBaseSI}: convert a base-SI scalar — an IDS
|
|
@@ -176,61 +199,88 @@ export function toBaseSI(rawValue, dataType, scales) {
|
|
|
176
199
|
export function toRaw(baseSIValue, dataType, scales) {
|
|
177
200
|
if (typeof baseSIValue !== 'number')
|
|
178
201
|
return baseSIValue;
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
202
|
+
const c = measureConversionFor(dataType, scales);
|
|
203
|
+
return isIdentity(c) ? baseSIValue : fromSi(baseSIValue, c);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The conversion for a value whose property or quantity declares its OWN
|
|
207
|
+
* `Unit`. `siScale` is the parser's resolved SI factor of that unit
|
|
208
|
+
* (`unitSiScale` / `explicitUnitSiScale`), `symbol` its display symbol, `siOffset` its °F offset;
|
|
209
|
+
* an unresolved factor, a non-measure dataType or a monetary value (not an
|
|
210
|
+
* SI quantity) gives `undefined`: the value stays as written.
|
|
211
|
+
*/
|
|
212
|
+
export function ownUnitConversionFor(dataType, siScale, symbol, siOffset) {
|
|
213
|
+
const upper = dataType ? dataType.toUpperCase() : '';
|
|
214
|
+
if (!upper.endsWith('MEASURE') || upper === 'IFCMONETARYMEASURE')
|
|
215
|
+
return undefined;
|
|
216
|
+
return unitConversion(upper, siScale, symbol, siOffset);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* A list's display value is its members joined by the parser; rebuild it from
|
|
220
|
+
* the converted members so it matches them.
|
|
221
|
+
*/
|
|
222
|
+
function listDisplayValue(rawValue, values) {
|
|
223
|
+
return typeof rawValue === 'string' ? values.join(', ') : rawValue;
|
|
183
224
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const isUntypedTable = !dataType && Array.isArray(rawValues) && rawValues.length > 0;
|
|
187
|
-
if (!kind && !isUntypedTable) {
|
|
225
|
+
function convertAll(rawValue, rawValues, c) {
|
|
226
|
+
if (isIdentity(c))
|
|
188
227
|
return { value: rawValue, values: rawValues };
|
|
228
|
+
const values = Array.isArray(rawValues)
|
|
229
|
+
? rawValues.map((m) => {
|
|
230
|
+
const cm = convertNumeric(m, c);
|
|
231
|
+
return cm == null ? String(m) : String(cm);
|
|
232
|
+
})
|
|
233
|
+
: rawValues;
|
|
234
|
+
if (values && values.length > 1 && typeof rawValue === 'string') {
|
|
235
|
+
return { value: listDisplayValue(rawValue, values), values };
|
|
189
236
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
expanded.push(String(c));
|
|
206
|
-
}
|
|
207
|
-
return { value: rawValue, values: expanded };
|
|
237
|
+
const v = typeof rawValue === 'boolean' || rawValue === null ? null : convertNumeric(rawValue, c);
|
|
238
|
+
return { value: v == null ? rawValue : v, values };
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Convert a value whose property or quantity declares its OWN `Unit` into
|
|
242
|
+
* SI. IFC uses that `Unit` precisely to let one value depart from the
|
|
243
|
+
* project's unit assignment, so the project factor must not be applied to
|
|
244
|
+
* it (#7395). A unit that is present but could not be read leaves the value
|
|
245
|
+
* raw rather than silently rescaled by the project factor.
|
|
246
|
+
*/
|
|
247
|
+
export function applyOwnUnitConversion(rawValue, rawValues, dataType, siScale, symbol, valueDataTypes, siOffset) {
|
|
248
|
+
// A mixed list has no shared dataType; convert each member by its own type.
|
|
249
|
+
if (!dataType && Array.isArray(rawValues) && rawValues.length > 0 && valueDataTypes?.length === rawValues.length) {
|
|
250
|
+
const values = convertTypedMembers(rawValues, valueDataTypes, (t) => ownUnitConversionFor(t, siScale, symbol, siOffset));
|
|
251
|
+
return { value: listDisplayValue(rawValue, values), values };
|
|
208
252
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
253
|
+
return convertAll(rawValue, rawValues, ownUnitConversionFor(dataType, siScale, symbol, siOffset));
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Convert a value held in the project's units into SI. A multi-valued
|
|
257
|
+
* property without a shared `dataType` converts each member by its own
|
|
258
|
+
* type (`valueDataTypes`, index-aligned with `rawValues`); without those
|
|
259
|
+
* types, see the module doc's legacy double-up.
|
|
260
|
+
*/
|
|
261
|
+
export function applyUnitConversion(rawValue, rawValues, dataType, scale, measureScales, valueDataTypes) {
|
|
262
|
+
const scales = { length: scale, ...measureScales };
|
|
263
|
+
const isUntypedMulti = !dataType && Array.isArray(rawValues) && rawValues.length > 0;
|
|
264
|
+
if (!isUntypedMulti) {
|
|
265
|
+
return convertAll(rawValue, rawValues, measureConversionFor(dataType, scales));
|
|
266
|
+
}
|
|
267
|
+
if (valueDataTypes && valueDataTypes.length === rawValues.length) {
|
|
268
|
+
const values = convertTypedMembers(rawValues, valueDataTypes, (t) => measureConversionFor(t, scales));
|
|
269
|
+
return { value: listDisplayValue(rawValue, values), values };
|
|
270
|
+
}
|
|
271
|
+
if (!scale || scale === 1) {
|
|
218
272
|
return { value: rawValue, values: rawValues };
|
|
219
273
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return c == null ? String(v) : String(c);
|
|
232
|
-
})
|
|
233
|
-
: rawValues;
|
|
234
|
-
return { value: converted, values };
|
|
274
|
+
// Untyped members of unknown type — keep raw values and append
|
|
275
|
+
// length-scaled copies for every numeric candidate so either unit space
|
|
276
|
+
// matches.
|
|
277
|
+
const expanded = [];
|
|
278
|
+
for (const v of rawValues) {
|
|
279
|
+
expanded.push(String(v));
|
|
280
|
+
const c = convertNumeric(v, { scale, offset: 0 });
|
|
281
|
+
if (c != null && String(c) !== String(v))
|
|
282
|
+
expanded.push(String(c));
|
|
283
|
+
}
|
|
284
|
+
return { value: rawValue, values: expanded };
|
|
235
285
|
}
|
|
236
286
|
//# sourceMappingURL=units.js.map
|