@ifc-lite/parser 4.3.1 → 5.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.
Files changed (176) hide show
  1. package/dist/attribute-helpers.d.ts +38 -4
  2. package/dist/attribute-helpers.d.ts.map +1 -1
  3. package/dist/attribute-helpers.js +71 -4
  4. package/dist/attribute-helpers.js.map +1 -1
  5. package/dist/columnar-parser-attributes.d.ts.map +1 -1
  6. package/dist/columnar-parser-attributes.js +35 -5
  7. package/dist/columnar-parser-attributes.js.map +1 -1
  8. package/dist/columnar-parser-indexes.d.ts.map +1 -1
  9. package/dist/columnar-parser-indexes.js +17 -2
  10. package/dist/columnar-parser-indexes.js.map +1 -1
  11. package/dist/columnar-parser-relationships.d.ts.map +1 -1
  12. package/dist/columnar-parser-relationships.js +6 -1
  13. package/dist/columnar-parser-relationships.js.map +1 -1
  14. package/dist/columnar-parser.d.ts +3 -1
  15. package/dist/columnar-parser.d.ts.map +1 -1
  16. package/dist/columnar-parser.js +27 -76
  17. package/dist/columnar-parser.js.map +1 -1
  18. package/dist/compact-entity-index-transport.d.ts +23 -0
  19. package/dist/compact-entity-index-transport.d.ts.map +1 -0
  20. package/dist/compact-entity-index-transport.js +28 -0
  21. package/dist/compact-entity-index-transport.js.map +1 -0
  22. package/dist/compact-entity-index.d.ts +0 -10
  23. package/dist/compact-entity-index.d.ts.map +1 -1
  24. package/dist/compact-entity-index.js +31 -24
  25. package/dist/compact-entity-index.js.map +1 -1
  26. package/dist/data-store-transport.d.ts +2 -12
  27. package/dist/data-store-transport.d.ts.map +1 -1
  28. package/dist/data-store-transport.js +7 -20
  29. package/dist/data-store-transport.js.map +1 -1
  30. package/dist/entity-extractor.d.ts.map +1 -1
  31. package/dist/entity-extractor.js +101 -6
  32. package/dist/entity-extractor.js.map +1 -1
  33. package/dist/entity-refs-from-index.d.ts.map +1 -1
  34. package/dist/entity-refs-from-index.js +12 -2
  35. package/dist/entity-refs-from-index.js.map +1 -1
  36. package/dist/entity-scanner.d.ts +63 -0
  37. package/dist/entity-scanner.d.ts.map +1 -1
  38. package/dist/entity-scanner.js +79 -2
  39. package/dist/entity-scanner.js.map +1 -1
  40. package/dist/express-id.d.ts +47 -0
  41. package/dist/express-id.d.ts.map +1 -0
  42. package/dist/express-id.js +57 -0
  43. package/dist/express-id.js.map +1 -0
  44. package/dist/generated/entities.d.ts +1 -1
  45. package/dist/generated/entities.d.ts.map +1 -1
  46. package/dist/generated/schema-registry.js +146 -146
  47. package/dist/generated/schema-registry.js.map +1 -1
  48. package/dist/georef-epset.d.ts +25 -0
  49. package/dist/georef-epset.d.ts.map +1 -0
  50. package/dist/georef-epset.js +214 -0
  51. package/dist/georef-epset.js.map +1 -0
  52. package/dist/georef-extractor.d.ts +9 -12
  53. package/dist/georef-extractor.d.ts.map +1 -1
  54. package/dist/georef-extractor.js +66 -304
  55. package/dist/georef-extractor.js.map +1 -1
  56. package/dist/georef-map-conversion.d.ts +29 -0
  57. package/dist/georef-map-conversion.d.ts.map +1 -0
  58. package/dist/georef-map-conversion.js +75 -0
  59. package/dist/georef-map-conversion.js.map +1 -0
  60. package/dist/georef-transform.d.ts +25 -0
  61. package/dist/georef-transform.d.ts.map +1 -0
  62. package/dist/georef-transform.js +97 -0
  63. package/dist/georef-transform.js.map +1 -0
  64. package/dist/ifc-schema.d.ts +4 -2
  65. package/dist/ifc-schema.d.ts.map +1 -1
  66. package/dist/ifc-schema.js +15 -5
  67. package/dist/ifc-schema.js.map +1 -1
  68. package/dist/index.d.ts +5 -2
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +5 -2
  71. package/dist/index.js.map +1 -1
  72. package/dist/map-unit-label.d.ts +43 -0
  73. package/dist/map-unit-label.d.ts.map +1 -0
  74. package/dist/map-unit-label.js +140 -0
  75. package/dist/map-unit-label.js.map +1 -0
  76. package/dist/material-extractor.d.ts +2 -17
  77. package/dist/material-extractor.d.ts.map +1 -1
  78. package/dist/material-extractor.js +12 -37
  79. package/dist/material-extractor.js.map +1 -1
  80. package/dist/material-layer-reader.d.ts +45 -0
  81. package/dist/material-layer-reader.d.ts.map +1 -0
  82. package/dist/material-layer-reader.js +63 -0
  83. package/dist/material-layer-reader.js.map +1 -0
  84. package/dist/material-resolver.d.ts.map +1 -1
  85. package/dist/material-resolver.js +14 -14
  86. package/dist/material-resolver.js.map +1 -1
  87. package/dist/measure-unit-scale.d.ts +41 -0
  88. package/dist/measure-unit-scale.d.ts.map +1 -0
  89. package/dist/measure-unit-scale.js +53 -0
  90. package/dist/measure-unit-scale.js.map +1 -0
  91. package/dist/on-demand-cache.d.ts +3 -0
  92. package/dist/on-demand-cache.d.ts.map +1 -0
  93. package/dist/on-demand-cache.js +25 -0
  94. package/dist/on-demand-cache.js.map +1 -0
  95. package/dist/on-demand-extractors.d.ts +5 -21
  96. package/dist/on-demand-extractors.d.ts.map +1 -1
  97. package/dist/on-demand-extractors.js +64 -437
  98. package/dist/on-demand-extractors.js.map +1 -1
  99. package/dist/on-demand-georeferencing.d.ts +19 -0
  100. package/dist/on-demand-georeferencing.d.ts.map +1 -0
  101. package/dist/on-demand-georeferencing.js +139 -0
  102. package/dist/on-demand-georeferencing.js.map +1 -0
  103. package/dist/owning-project.d.ts +54 -0
  104. package/dist/owning-project.d.ts.map +1 -0
  105. package/dist/owning-project.js +76 -0
  106. package/dist/owning-project.js.map +1 -0
  107. package/dist/parser.worker.d.ts +14 -0
  108. package/dist/parser.worker.d.ts.map +1 -1
  109. package/dist/parser.worker.js +2 -0
  110. package/dist/parser.worker.js.map +1 -1
  111. package/dist/project-units-symbols.d.ts +33 -0
  112. package/dist/project-units-symbols.d.ts.map +1 -0
  113. package/dist/project-units-symbols.js +265 -0
  114. package/dist/project-units-symbols.js.map +1 -0
  115. package/dist/project-units.d.ts +11 -19
  116. package/dist/project-units.d.ts.map +1 -1
  117. package/dist/project-units.js +9 -267
  118. package/dist/project-units.js.map +1 -1
  119. package/dist/property-set-merge.d.ts +65 -8
  120. package/dist/property-set-merge.d.ts.map +1 -1
  121. package/dist/property-set-merge.js +130 -29
  122. package/dist/property-set-merge.js.map +1 -1
  123. package/dist/property-value-parser.d.ts +55 -0
  124. package/dist/property-value-parser.d.ts.map +1 -0
  125. package/dist/property-value-parser.js +277 -0
  126. package/dist/property-value-parser.js.map +1 -0
  127. package/dist/quantity-collect.d.ts +135 -0
  128. package/dist/quantity-collect.d.ts.map +1 -0
  129. package/dist/quantity-collect.js +253 -0
  130. package/dist/quantity-collect.js.map +1 -0
  131. package/dist/query-backend-maps.d.ts +5 -8
  132. package/dist/query-backend-maps.d.ts.map +1 -1
  133. package/dist/query-backend-maps.js +159 -15
  134. package/dist/query-backend-maps.js.map +1 -1
  135. package/dist/relationship-extractor.d.ts.map +1 -1
  136. package/dist/relationship-extractor.js +18 -0
  137. package/dist/relationship-extractor.js.map +1 -1
  138. package/dist/scan-entities-balanced.d.ts +38 -0
  139. package/dist/scan-entities-balanced.d.ts.map +1 -0
  140. package/dist/scan-entities-balanced.js +258 -0
  141. package/dist/scan-entities-balanced.js.map +1 -0
  142. package/dist/scan-worker-inline.d.ts +17 -11
  143. package/dist/scan-worker-inline.d.ts.map +1 -1
  144. package/dist/scan-worker-inline.js +9 -235
  145. package/dist/scan-worker-inline.js.map +1 -1
  146. package/dist/scan-worker-source.d.ts +9 -0
  147. package/dist/scan-worker-source.d.ts.map +1 -0
  148. package/dist/scan-worker-source.js +383 -0
  149. package/dist/scan-worker-source.js.map +1 -0
  150. package/dist/source-header.d.ts +23 -1
  151. package/dist/source-header.d.ts.map +1 -1
  152. package/dist/source-header.js +133 -43
  153. package/dist/source-header.js.map +1 -1
  154. package/dist/spatial-hierarchy-builder.js +3 -3
  155. package/dist/spatial-hierarchy-builder.js.map +1 -1
  156. package/dist/step-lexing.d.ts +94 -0
  157. package/dist/step-lexing.d.ts.map +1 -1
  158. package/dist/step-lexing.js +292 -25
  159. package/dist/step-lexing.js.map +1 -1
  160. package/dist/step-trivia.d.ts +60 -0
  161. package/dist/step-trivia.d.ts.map +1 -0
  162. package/dist/step-trivia.js +63 -0
  163. package/dist/step-trivia.js.map +1 -0
  164. package/dist/tokenizer.d.ts +20 -21
  165. package/dist/tokenizer.d.ts.map +1 -1
  166. package/dist/tokenizer.js +164 -203
  167. package/dist/tokenizer.js.map +1 -1
  168. package/dist/unit-extractor.d.ts +56 -1
  169. package/dist/unit-extractor.d.ts.map +1 -1
  170. package/dist/unit-extractor.js +80 -6
  171. package/dist/unit-extractor.js.map +1 -1
  172. package/dist/worker-parser.d.ts +11 -1
  173. package/dist/worker-parser.d.ts.map +1 -1
  174. package/dist/worker-parser.js +16 -2
  175. package/dist/worker-parser.js.map +1 -1
  176. package/package.json +6 -6
@@ -2,30 +2,27 @@
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
  /**
5
- * Compose an occurrence's own property sets with those it inherits from its
6
- * `IfcTypeProduct`, the way IFC defines the inheritance: **per property, not
7
- * per property set**.
8
- *
9
- * An occurrence and its type routinely both carry a set of the same name —
10
- * `Pset_CoveringCommon` holding `IsExternal`/`Reference` on the occurrence and
11
- * `SurfaceSpreadOfFlame`/`Combustible` on the type is a plain Revit export.
12
- * Dropping the whole inherited set on a name collision makes every type-only
13
- * property in it invisible, which is what made IDS report a present property as
14
- * missing (#1913). Where both define the same property name, the occurrence
15
- * wins — it is the more specific definition.
5
+ * How property/quantity sets coming from two different sources compose: an
6
+ * occurrence's own sets with the ones it inherits from its `IfcTypeProduct`
7
+ * ({@link mergeInheritedPropertySets}, {@link mergeInheritedQuantitySets}),
8
+ * and a type's `HasPropertySets` list with the sets attached to it by
9
+ * `IfcRelDefinesByProperties` ({@link appendSetsFromSecondSource}).
16
10
  *
17
- * An occurrence may carry **several** sets of one name (one per
18
- * `IfcRelDefinesByProperties`; nothing dedupes them, and merged/federated
19
- * exports produce them). Inherited properties are merged into *every* one of
20
- * them, not just the first: IDS requires every set matching the facet's
21
- * `propertySet` constraint to satisfy it, so augmenting one and leaving its
22
- * twin bare would reintroduce the same false "not found" this rule exists to
23
- * prevent.
11
+ * Their own module rather than a corner of `on-demand-extractors.ts`: the rules
12
+ * are independent of how either side was extracted, and every consumer that
13
+ * resolves sets from more than one source needs the same answer.
14
+ */
15
+ /**
16
+ * Compose an occurrence's own named sets with those it inherits from its
17
+ * `IfcTypeProduct`, the way IFC defines the inheritance: **per item (property
18
+ * or quantity), not per set**. Shared core for {@link mergeInheritedPropertySets}
19
+ * and {@link mergeInheritedQuantitySets} — see those for the rule this
20
+ * implements and why.
24
21
  *
25
- * Neither input is mutated: a set that gains inherited properties is returned
26
- * as a new object, so cached extractor results stay intact.
22
+ * `getItems`/`withItems` isolate the one difference between the two: which
23
+ * field holds the named children (`properties` vs `quantities`).
27
24
  */
28
- export function mergeInheritedPropertySets(ownSets, inheritedSets) {
25
+ function mergeInheritedNamedSets(ownSets, inheritedSets, getItems, withItems) {
29
26
  if (inheritedSets.length === 0)
30
27
  return ownSets.slice();
31
28
  const merged = ownSets.slice();
@@ -38,7 +35,13 @@ export function mergeInheritedPropertySets(ownSets, inheritedSets) {
38
35
  indicesByName.set(merged[i].name, [i]);
39
36
  }
40
37
  for (const inherited of inheritedSets) {
41
- const indices = indicesByName.get(inherited.name);
38
+ // An UNNAMED set matches nothing: since #3530 every set the source left
39
+ // without a Name reports `''`, so keying on it would fold an unnamed
40
+ // inherited set into an unrelated unnamed occurrence set and lose any
41
+ // item the two happen to share. Before #3530 the two carried distinct
42
+ // placeholder names and were kept apart here; an absent name is
43
+ // evidence of nothing, least of all of sameness.
44
+ const indices = inherited.name ? indicesByName.get(inherited.name) : undefined;
42
45
  if (!indices) {
43
46
  // Appended as-is, and deliberately NOT recorded in `indicesByName`:
44
47
  // that index tracks OCCURRENCE sets only. Recording it would make a
@@ -50,17 +53,115 @@ export function mergeInheritedPropertySets(ownSets, inheritedSets) {
50
53
  }
51
54
  for (const index of indices) {
52
55
  const own = merged[index];
53
- const ownPropNames = new Set(own.properties.map((p) => p.name));
54
- const additions = inherited.properties.filter((p) => !ownPropNames.has(p.name));
56
+ const ownItems = getItems(own);
57
+ const ownNames = new Set(ownItems.map((p) => p.name));
58
+ const additions = getItems(inherited).filter((p) => !ownNames.has(p.name));
55
59
  if (additions.length === 0)
56
60
  continue;
57
- // `as T`: the spread reproduces every field of `own` and replaces
58
- // only `properties` with a superset of the same element type, but
59
- // TypeScript cannot narrow a spread of an unresolved generic back
60
- // to that generic.
61
- merged[index] = { ...own, properties: [...own.properties, ...additions] };
61
+ merged[index] = withItems(own, [...ownItems, ...additions]);
62
62
  }
63
63
  }
64
64
  return merged;
65
65
  }
66
+ /**
67
+ * Compose an occurrence's own property sets with those it inherits from its
68
+ * `IfcTypeProduct`, the way IFC defines the inheritance: **per property, not
69
+ * per property set**.
70
+ *
71
+ * An occurrence and its type routinely both carry a set of the same name —
72
+ * `Pset_CoveringCommon` holding `IsExternal`/`Reference` on the occurrence and
73
+ * `SurfaceSpreadOfFlame`/`Combustible` on the type is a plain Revit export.
74
+ * Dropping the whole inherited set on a name collision makes every type-only
75
+ * property in it invisible, which is what made IDS report a present property as
76
+ * missing (#1913). Where both define the same property name, the occurrence
77
+ * wins — it is the more specific definition.
78
+ *
79
+ * An occurrence may carry **several** sets of one name (one per
80
+ * `IfcRelDefinesByProperties`; nothing dedupes them, and merged/federated
81
+ * exports produce them). Inherited properties are merged into *every* one of
82
+ * them, not just the first: IDS requires every set matching the facet's
83
+ * `propertySet` constraint to satisfy it, so augmenting one and leaving its
84
+ * twin bare would reintroduce the same false "not found" this rule exists to
85
+ * prevent.
86
+ *
87
+ * Neither input is mutated: a set that gains inherited properties is returned
88
+ * as a new object, so cached extractor results stay intact.
89
+ */
90
+ export function mergeInheritedPropertySets(ownSets, inheritedSets) {
91
+ return mergeInheritedNamedSets(ownSets, inheritedSets, (set) => set.properties,
92
+ // `as T`: the spread reproduces every field of `set` and replaces only
93
+ // `properties` with a superset of the same element type, but
94
+ // TypeScript cannot narrow a spread of an unresolved generic back to
95
+ // that generic.
96
+ (set, properties) => ({ ...set, properties }));
97
+ }
98
+ /**
99
+ * Compose an occurrence's own quantity sets (`IfcElementQuantity`) with those
100
+ * it inherits from its `IfcTypeProduct`, applying the same per-item rule
101
+ * {@link mergeInheritedPropertySets} applies to property sets: a same-named
102
+ * set does not replace or get replaced wholesale, it is topped up quantity by
103
+ * quantity, and the occurrence wins a same-named-quantity collision.
104
+ *
105
+ * IFC does not distinguish properties from quantities for this purpose —
106
+ * both live in the type's `HasPropertySets` list alongside each other — so a
107
+ * consumer that resolves inherited properties this way but resolves
108
+ * quantities by only ever looking at the occurrence's own sets silently
109
+ * drops every quantity a type-level `Qto_*` set carries (e.g.
110
+ * `Qto_WallBaseQuantities` attached to `IfcWallType` rather than each wall).
111
+ */
112
+ export function mergeInheritedQuantitySets(ownSets, inheritedSets) {
113
+ return mergeInheritedNamedSets(ownSets, inheritedSets, (set) => set.quantities, (set, quantities) => ({ ...set, quantities }));
114
+ }
115
+ /**
116
+ * Identity key for a property/quantity set: `(name, globalId)` joined with a
117
+ * NUL separator, the same convention `groupPropertySetsByInstance`/
118
+ * `groupQuantitySetsByInstance` (`@ifc-lite/data`) use for the occurrence-level
119
+ * `PropertyTable`/`QuantityTable` (#3603, #3606). A name alone is only a proxy
120
+ * for identity: two distinct `IfcPropertySet`/`IfcElementQuantity` instances
121
+ * routinely share a literal name (a federated merge, or an exporter emitting
122
+ * the same `Qto_` set twice), and a name-only key folds one into the other,
123
+ * silently dropping whichever loses (#3722). Those helpers operate on
124
+ * columnar `Uint32Array` string-table indices and this module on
125
+ * already-extracted set objects, so the identity-key SHAPE is shared but not
126
+ * the function itself.
127
+ */
128
+ export function setIdentityKey(set) {
129
+ return set.name + '\u0000' + (set.globalId ?? '');
130
+ }
131
+ /**
132
+ * Append the sets a type carries via `IfcRelDefinesByProperties` to the ones
133
+ * already collected from its `HasPropertySets` attribute, listing a set that is
134
+ * reachable BOTH ways only once.
135
+ *
136
+ * The dedupe is by express id first. A name is only a proxy for identity, and
137
+ * since #3530 it stopped being even that: every set the source left unnamed
138
+ * now reports `''`, so a name-only check would fold every unnamed set from the
139
+ * second source into the first unnamed one from the first and drop its
140
+ * properties outright. The identity-key check ({@link setIdentityKey}) is still
141
+ * applied on top for genuinely named sets, where an empty set from one source
142
+ * must not shadow a populated same-named set from the other -- but it keys on
143
+ * `(name, globalId)`, not name alone, so two distinct same-named instances
144
+ * (different GlobalId) both survive (#3722); only a second row of the SAME
145
+ * instance still collapses.
146
+ *
147
+ * `extract` is called at most once, with the ids the first source did not
148
+ * already contribute.
149
+ */
150
+ export function appendSetsFromSecondSource(into, firstSourceIds, firstSourceKeys, candidateIds, extract) {
151
+ const fresh = candidateIds.filter((id) => !firstSourceIds.has(id));
152
+ if (fresh.length === 0)
153
+ return;
154
+ const acceptedKeys = new Set();
155
+ for (const set of extract(fresh)) {
156
+ // A set with either a name or a globalId has an identity worth
157
+ // deduplicating on; only a set with neither passes through unkeyed.
158
+ if (set.name || set.globalId) {
159
+ const key = setIdentityKey(set);
160
+ if (firstSourceKeys.has(key) || acceptedKeys.has(key))
161
+ continue;
162
+ acceptedKeys.add(key);
163
+ }
164
+ into.push(set);
165
+ }
166
+ }
66
167
  //# sourceMappingURL=property-set-merge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"property-set-merge.js","sourceRoot":"","sources":["../src/property-set-merge.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAsB/D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,0BAA0B,CACtC,OAAqB,EACrB,aAA2B;IAE3B,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;IAEvD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAC/B,MAAM,aAAa,GAAG,IAAI,GAAG,EAAoB,CAAC;IAClD,KAAK,IAAI,CAAC,GAAG,CAAC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,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Property VALUE parsing for the on-demand STEP extraction path: decodes a
3
+ * single `IfcProperty` subtype entity (IfcPropertySingleValue,
4
+ * IfcPropertyEnumeratedValue, IfcPropertyBoundedValue, IfcPropertyListValue,
5
+ * IfcPropertyTableValue, IfcPropertyReferenceValue, IfcComplexProperty) into
6
+ * the `{ type, value, values?, dataType? }` shape the property panel/query
7
+ * layer consumes. Split out of on-demand-extractors.ts to stay under the
8
+ * module-size budget.
9
+ */
10
+ import type { IfcEntity } from './types.js';
11
+ import type { EntityExtractor } from './entity-extractor.js';
12
+ import type { PropertyValue } from '@ifc-lite/data';
13
+ import type { IfcDataStore } from './columnar-parser.js';
14
+ /**
15
+ * Parse a property entity's value based on its IFC type.
16
+ * Handles all 6 IfcProperty subtypes:
17
+ * - IfcPropertySingleValue: direct value
18
+ * - IfcPropertyEnumeratedValue: list of enum values → joined string
19
+ * - IfcPropertyBoundedValue: upper/lower bounds → "value [min – max]"
20
+ * - IfcPropertyListValue: list of values → joined string
21
+ * - IfcPropertyTableValue: defining/defined value pairs → "Table(N rows)"
22
+ * - IfcPropertyReferenceValue: entity reference → "Reference #ID"
23
+ */
24
+ export declare function parsePropertyValue(propEntity: IfcEntity): {
25
+ type: number;
26
+ value: PropertyValue;
27
+ values?: string[];
28
+ dataType?: string;
29
+ };
30
+ /** Extract a numeric value from a possibly typed STEP value. */
31
+ export declare function extractNumericValue(attr: unknown): number | null;
32
+ /**
33
+ * Resolve an `IfcComplexProperty`'s nested `HasProperties` (EXPRESS:
34
+ * `[Name, Description, UsageName, HasProperties]`, index 3) into a display
35
+ * value plus a flat `values` candidate list, recursing into any further
36
+ * nested `IfcComplexProperty`. Without this, {@link parsePropertyValue}'s
37
+ * default branch reads attribute index 2 as if it were a `NominalValue`,
38
+ * which for `IfcComplexProperty` is `UsageName` — a label, not a value — and
39
+ * every nested property silently vanishes from the panel/query output.
40
+ */
41
+ export declare function resolveComplexPropertyValue(store: IfcDataStore, extractor: EntityExtractor, propEntity: IfcEntity, depth?: number): {
42
+ type: number;
43
+ value: PropertyValue;
44
+ values?: string[];
45
+ dataType?: string;
46
+ };
47
+ /** Dispatch a pset member to {@link resolveComplexPropertyValue} for
48
+ * `IfcComplexProperty`, else the single-entity {@link parsePropertyValue}. */
49
+ export declare function parsePropertyValueWithComplex(store: IfcDataStore, extractor: EntityExtractor, propEntity: IfcEntity): {
50
+ type: number;
51
+ value: PropertyValue;
52
+ values?: string[];
53
+ dataType?: string;
54
+ };
55
+ //# sourceMappingURL=property-value-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-value-parser.d.ts","sourceRoot":"","sources":["../src/property-value-parser.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAMzD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,aAAa,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CA4LtI;AAED,gEAAgE;AAChE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAIhE;AAOD;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACvC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,SAAS,EACrB,KAAK,SAAI,GACV;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,aAAa,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAoC9E;AAED;+EAC+E;AAC/E,wBAAgB,6BAA6B,CACzC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,SAAS,GACtB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,aAAa,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAK9E"}
@@ -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 { PropertyValueType } from '@ifc-lite/data';
5
+ // ============================================================================
6
+ // Property Value Parsing Helpers
7
+ // ============================================================================
8
+ /**
9
+ * Parse a property entity's value based on its IFC type.
10
+ * Handles all 6 IfcProperty subtypes:
11
+ * - IfcPropertySingleValue: direct value
12
+ * - IfcPropertyEnumeratedValue: list of enum values → joined string
13
+ * - IfcPropertyBoundedValue: upper/lower bounds → "value [min – max]"
14
+ * - IfcPropertyListValue: list of values → joined string
15
+ * - IfcPropertyTableValue: defining/defined value pairs → "Table(N rows)"
16
+ * - IfcPropertyReferenceValue: entity reference → "Reference #ID"
17
+ */
18
+ export function parsePropertyValue(propEntity) {
19
+ const attrs = propEntity.attributes || [];
20
+ const typeUpper = propEntity.type.toUpperCase();
21
+ switch (typeUpper) {
22
+ case 'IFCPROPERTYENUMERATEDVALUE': {
23
+ // [Name, Description, EnumerationValues (list), EnumerationReference]
24
+ const enumValues = attrs[2];
25
+ if (Array.isArray(enumValues)) {
26
+ const values = enumValues.map(v => {
27
+ if (Array.isArray(v) && v.length === 2)
28
+ return String(v[1]); // Typed value
29
+ return String(v);
30
+ }).filter(v => v !== 'null' && v !== 'undefined');
31
+ // Surface the raw value list separately so IDS facet
32
+ // checks can iterate "any matching value passes". The
33
+ // joined display string remains the primary `value`
34
+ // for visualisation/property-table consumers.
35
+ return { type: 0, value: values.join(', ') || null, values };
36
+ }
37
+ return { type: 0, value: null };
38
+ }
39
+ case 'IFCPROPERTYBOUNDEDVALUE': {
40
+ // [Name, Description, UpperBoundValue, LowerBoundValue, Unit, SetPointValue]
41
+ const upper = extractNumericValue(attrs[2]);
42
+ const lower = extractNumericValue(attrs[3]);
43
+ const setPoint = extractNumericValue(attrs[5]);
44
+ const displayValue = setPoint ?? upper ?? lower;
45
+ let display = displayValue != null ? String(displayValue) : '';
46
+ if (lower != null && upper != null) {
47
+ display += ` [${lower} – ${upper}]`;
48
+ }
49
+ // Surface every defined bound as a candidate value — IDS
50
+ // bounded-property checks pass when ANY of the bounds /
51
+ // setpoint matches the constraint, per upstream ifctester.
52
+ const candidates = [];
53
+ if (lower != null)
54
+ candidates.push(String(lower));
55
+ if (upper != null && upper !== lower)
56
+ candidates.push(String(upper));
57
+ if (setPoint != null && setPoint !== lower && setPoint !== upper) {
58
+ candidates.push(String(setPoint));
59
+ }
60
+ // Carry the IFC-declared measure tag so the IDS-side data
61
+ // type comparison and unit conversion both work.
62
+ const inferDataType = (attr) => {
63
+ if (Array.isArray(attr) && attr.length === 2) {
64
+ return String(attr[0]).toUpperCase();
65
+ }
66
+ return undefined;
67
+ };
68
+ const dataType = inferDataType(attrs[5]) ||
69
+ inferDataType(attrs[2]) ||
70
+ inferDataType(attrs[3]);
71
+ return {
72
+ type: displayValue != null ? 1 : 0,
73
+ value: display || null,
74
+ ...(candidates.length > 0 ? { values: candidates } : {}),
75
+ ...(dataType ? { dataType } : {}),
76
+ };
77
+ }
78
+ case 'IFCPROPERTYLISTVALUE': {
79
+ // [Name, Description, ListValues (list), Unit]
80
+ const listValues = attrs[2];
81
+ if (Array.isArray(listValues)) {
82
+ const values = listValues.map(v => {
83
+ if (Array.isArray(v) && v.length === 2)
84
+ return String(v[1]);
85
+ return String(v);
86
+ }).filter(v => v !== 'null' && v !== 'undefined');
87
+ return { type: 0, value: values.join(', ') || null, values };
88
+ }
89
+ return { type: 0, value: null };
90
+ }
91
+ case 'IFCPROPERTYTABLEVALUE': {
92
+ // [Name, Description, DefiningValues, DefinedValues, ...]
93
+ const definingValues = attrs[2];
94
+ const definedValues = attrs[3];
95
+ const rowCount = Array.isArray(definingValues) ? definingValues.length : 0;
96
+ if (rowCount > 0 && Array.isArray(definedValues) && Array.isArray(definingValues)) {
97
+ // Surface both defining and defined values as candidate
98
+ // matches — IDS table-value checks pass when ANY entry
99
+ // matches the constraint (per upstream ifctester).
100
+ const stringify = (v) => {
101
+ if (Array.isArray(v) && v.length === 2)
102
+ return String(v[1]);
103
+ return String(v);
104
+ };
105
+ const values = [
106
+ ...definingValues.map(stringify),
107
+ ...definedValues.map(stringify),
108
+ ].filter(v => v !== 'null' && v !== 'undefined');
109
+ // Tables mix types per column (label / length / …),
110
+ // so we can't surface a single representative
111
+ // dataType. Leaving it unset lets the IDS check fall
112
+ // through to a pure value match against any of the
113
+ // candidates — which is what upstream ifctester does
114
+ // for table values.
115
+ return {
116
+ type: 0,
117
+ value: `Table (${rowCount} rows)`,
118
+ values,
119
+ };
120
+ }
121
+ return { type: 0, value: null };
122
+ }
123
+ case 'IFCPROPERTYREFERENCEVALUE': {
124
+ // [Name, Description, PropertyReference]
125
+ const refValue = attrs[2];
126
+ if (typeof refValue === 'number') {
127
+ return { type: 0, value: `#${refValue}` };
128
+ }
129
+ return { type: 0, value: null };
130
+ }
131
+ default: {
132
+ // IfcPropertySingleValue and fallback: [Name, Description, NominalValue, Unit]
133
+ const nominalValue = attrs[2];
134
+ let type = PropertyValueType.String;
135
+ let value = nominalValue;
136
+ let dataType;
137
+ // Handle typed values like IFCBOOLEAN(.T.), IFCREAL(1.5)
138
+ if (Array.isArray(nominalValue) && nominalValue.length === 2) {
139
+ const innerValue = nominalValue[1];
140
+ const typeName = String(nominalValue[0]).toUpperCase();
141
+ dataType = typeName;
142
+ if (typeName.includes('BOOLEAN')) {
143
+ type = PropertyValueType.Boolean;
144
+ value = innerValue === '.T.' || innerValue === true;
145
+ }
146
+ else if (typeName.includes('LOGICAL')) {
147
+ type = PropertyValueType.Logical;
148
+ // Preserve .U. (unknown) as null; .T./.F. as boolean
149
+ if (innerValue === '.U.' || innerValue === '.X.') {
150
+ value = null;
151
+ }
152
+ else {
153
+ value = innerValue === '.T.' || innerValue === true;
154
+ }
155
+ }
156
+ else if (typeof innerValue === 'number') {
157
+ // Preserve the IFC-declared numeric measure (IFCREAL,
158
+ // IFCINTEGER, IFCLENGTHMEASURE, IFCAREAMEASURE, …) —
159
+ // the source explicitly tagged the value, so don't
160
+ // re-infer from JS number-ness (which would
161
+ // misclassify e.g. `IFCREAL(0.0)` as integer).
162
+ if (typeName === 'IFCINTEGER' || typeName === 'IFCCOUNTMEASURE') {
163
+ type = PropertyValueType.Integer;
164
+ }
165
+ else if (typeName === 'IFCREAL' ||
166
+ typeName.endsWith('MEASURE') ||
167
+ typeName.endsWith('RATIO')) {
168
+ type = PropertyValueType.Real;
169
+ }
170
+ else if (Number.isInteger(innerValue)) {
171
+ type = PropertyValueType.Integer;
172
+ }
173
+ else {
174
+ type = PropertyValueType.Real;
175
+ }
176
+ value = innerValue;
177
+ }
178
+ else {
179
+ type = PropertyValueType.String;
180
+ value = String(innerValue);
181
+ }
182
+ }
183
+ else if (typeof nominalValue === 'number') {
184
+ type = Number.isInteger(nominalValue) ? PropertyValueType.Integer : PropertyValueType.Real;
185
+ }
186
+ else if (typeof nominalValue === 'boolean') {
187
+ type = PropertyValueType.Boolean;
188
+ }
189
+ else if (nominalValue !== null && nominalValue !== undefined) {
190
+ // Normalize untagged STEP enumeration tokens. Conformant IFC wraps
191
+ // booleans as IFCBOOLEAN(.T.) (handled above), but some authoring
192
+ // tools emit the bare tokens directly in the NominalValue slot.
193
+ if (nominalValue === '.T.') {
194
+ type = PropertyValueType.Boolean;
195
+ value = true;
196
+ }
197
+ else if (nominalValue === '.F.') {
198
+ type = PropertyValueType.Boolean;
199
+ value = false;
200
+ }
201
+ else if (nominalValue === '.U.' || nominalValue === '.X.') {
202
+ type = PropertyValueType.Logical;
203
+ value = null;
204
+ }
205
+ else {
206
+ value = String(nominalValue);
207
+ }
208
+ }
209
+ return { type, value, ...(dataType ? { dataType } : {}) };
210
+ }
211
+ }
212
+ }
213
+ /** Extract a numeric value from a possibly typed STEP value. */
214
+ export function extractNumericValue(attr) {
215
+ if (typeof attr === 'number')
216
+ return attr;
217
+ if (Array.isArray(attr) && attr.length === 2 && typeof attr[1] === 'number')
218
+ return attr[1];
219
+ return null;
220
+ }
221
+ /** Guards {@link resolveComplexPropertyValue} against a pathological/cyclic
222
+ * HasProperties chain; real IFC nests IfcComplexProperty at most a couple of
223
+ * levels deep (e.g. Pset "sub-properties"). */
224
+ const MAX_COMPLEX_PROPERTY_DEPTH = 8;
225
+ /**
226
+ * Resolve an `IfcComplexProperty`'s nested `HasProperties` (EXPRESS:
227
+ * `[Name, Description, UsageName, HasProperties]`, index 3) into a display
228
+ * value plus a flat `values` candidate list, recursing into any further
229
+ * nested `IfcComplexProperty`. Without this, {@link parsePropertyValue}'s
230
+ * default branch reads attribute index 2 as if it were a `NominalValue`,
231
+ * which for `IfcComplexProperty` is `UsageName` — a label, not a value — and
232
+ * every nested property silently vanishes from the panel/query output.
233
+ */
234
+ export function resolveComplexPropertyValue(store, extractor, propEntity, depth = 0) {
235
+ const attrs = propEntity.attributes || [];
236
+ const usageName = typeof attrs[2] === 'string' ? attrs[2] : '';
237
+ const hasProperties = attrs[3];
238
+ if (!Array.isArray(hasProperties) || depth >= MAX_COMPLEX_PROPERTY_DEPTH) {
239
+ return { type: PropertyValueType.String, value: usageName || null };
240
+ }
241
+ const parts = [];
242
+ const values = [];
243
+ for (const ref of hasProperties) {
244
+ if (typeof ref !== 'number')
245
+ continue;
246
+ const nestedRef = store.entityIndex.byId.get(ref) ?? store.deferredEntityIndex?.get(ref);
247
+ if (!nestedRef)
248
+ continue;
249
+ const nestedEntity = extractor.extractEntity(nestedRef);
250
+ if (!nestedEntity)
251
+ continue;
252
+ const nestedAttrs = nestedEntity.attributes || [];
253
+ const nestedName = typeof nestedAttrs[0] === 'string' ? nestedAttrs[0] : '';
254
+ const nestedParsed = nestedEntity.type.toUpperCase() === 'IFCCOMPLEXPROPERTY'
255
+ ? resolveComplexPropertyValue(store, extractor, nestedEntity, depth + 1)
256
+ : parsePropertyValue(nestedEntity);
257
+ const display = nestedParsed.value != null ? String(nestedParsed.value) : '';
258
+ if (!display)
259
+ continue;
260
+ parts.push(nestedName ? `${nestedName}: ${display}` : display);
261
+ values.push(display);
262
+ }
263
+ return {
264
+ type: PropertyValueType.String,
265
+ value: parts.length > 0 ? parts.join(', ') : (usageName || null),
266
+ ...(values.length > 0 ? { values } : {}),
267
+ };
268
+ }
269
+ /** Dispatch a pset member to {@link resolveComplexPropertyValue} for
270
+ * `IfcComplexProperty`, else the single-entity {@link parsePropertyValue}. */
271
+ export function parsePropertyValueWithComplex(store, extractor, propEntity) {
272
+ if (propEntity.type.toUpperCase() === 'IFCCOMPLEXPROPERTY') {
273
+ return resolveComplexPropertyValue(store, extractor, propEntity);
274
+ }
275
+ return parsePropertyValue(propEntity);
276
+ }
277
+ //# sourceMappingURL=property-value-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-value-parser.js","sourceRoot":"","sources":["../src/property-value-parser.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAc/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAInD,+EAA+E;AAC/E,iCAAiC;AACjC,+EAA+E;AAE/E;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAqB;IACpD,MAAM,KAAK,GAAG,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;IAC1C,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;IAEhD,QAAQ,SAAS,EAAE,CAAC;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