@ifc-lite/parser 5.2.0 → 6.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/dist/columnar-entity-preparation.d.ts +3 -0
- package/dist/columnar-entity-preparation.d.ts.map +1 -1
- package/dist/columnar-entity-preparation.js +101 -11
- package/dist/columnar-entity-preparation.js.map +1 -1
- package/dist/columnar-parser-indexes.d.ts +17 -1
- package/dist/columnar-parser-indexes.d.ts.map +1 -1
- package/dist/columnar-parser-indexes.js +31 -21
- package/dist/columnar-parser-indexes.js.map +1 -1
- package/dist/columnar-parser.d.ts +10 -1
- package/dist/columnar-parser.d.ts.map +1 -1
- package/dist/columnar-parser.js +14 -2
- package/dist/columnar-parser.js.map +1 -1
- package/dist/cost-extractor.d.ts +10 -0
- package/dist/cost-extractor.d.ts.map +1 -0
- package/dist/cost-extractor.js +369 -0
- package/dist/cost-extractor.js.map +1 -0
- package/dist/cost-schedule-2x3.d.ts +31 -0
- package/dist/cost-schedule-2x3.d.ts.map +1 -0
- package/dist/cost-schedule-2x3.js +75 -0
- package/dist/cost-schedule-2x3.js.map +1 -0
- package/dist/cost-types.d.ts +105 -0
- package/dist/cost-types.d.ts.map +1 -0
- package/dist/cost-types.js +5 -0
- package/dist/cost-types.js.map +1 -0
- package/dist/data-store-transport.d.ts +1 -0
- package/dist/data-store-transport.d.ts.map +1 -1
- package/dist/data-store-transport.js +5 -29
- package/dist/data-store-transport.js.map +1 -1
- package/dist/drop-census.d.ts +136 -0
- package/dist/drop-census.d.ts.map +1 -0
- package/dist/drop-census.js +53 -0
- package/dist/drop-census.js.map +1 -0
- package/dist/entity-scanner.d.ts.map +1 -1
- package/dist/entity-scanner.js +10 -5
- package/dist/entity-scanner.js.map +1 -1
- package/dist/generated/ifc2x3/schema-registry.d.ts +50 -0
- package/dist/generated/ifc2x3/schema-registry.d.ts.map +1 -0
- package/dist/generated/ifc2x3/schema-registry.js +50052 -0
- package/dist/generated/ifc2x3/schema-registry.js.map +1 -0
- package/dist/generated/ifc4x3/schema-registry.d.ts +50 -0
- package/dist/generated/ifc4x3/schema-registry.d.ts.map +1 -0
- package/dist/generated/ifc4x3/schema-registry.js +71299 -0
- package/dist/generated/ifc4x3/schema-registry.js.map +1 -0
- package/dist/generated/schema-registry-by-version.d.ts +61 -0
- package/dist/generated/schema-registry-by-version.d.ts.map +1 -0
- package/dist/generated/schema-registry-by-version.js +86 -0
- package/dist/generated/schema-registry-by-version.js.map +1 -0
- package/dist/group-assignment-factor.d.ts +13 -0
- package/dist/group-assignment-factor.d.ts.map +1 -0
- package/dist/group-assignment-factor.js +30 -0
- package/dist/group-assignment-factor.js.map +1 -0
- package/dist/ifczip.d.ts +6 -0
- package/dist/ifczip.d.ts.map +1 -1
- package/dist/ifczip.js +20 -11
- package/dist/ifczip.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/on-demand-extractors.d.ts +1 -0
- package/dist/on-demand-extractors.d.ts.map +1 -1
- package/dist/on-demand-extractors.js +2 -1
- package/dist/on-demand-extractors.js.map +1 -1
- package/dist/property-value-parser.d.ts +10 -0
- package/dist/property-value-parser.d.ts.map +1 -1
- package/dist/property-value-parser.js +40 -1
- package/dist/property-value-parser.js.map +1 -1
- package/dist/scan-entities-balanced.d.ts.map +1 -1
- package/dist/scan-entities-balanced.js +8 -6
- package/dist/scan-entities-balanced.js.map +1 -1
- package/dist/scan-worker-lexing.d.ts +14 -0
- package/dist/scan-worker-lexing.d.ts.map +1 -0
- package/dist/scan-worker-lexing.js +101 -0
- package/dist/scan-worker-lexing.js.map +1 -0
- package/dist/scan-worker-source.d.ts +1 -1
- package/dist/scan-worker-source.d.ts.map +1 -1
- package/dist/scan-worker-source.js +61 -59
- package/dist/scan-worker-source.js.map +1 -1
- package/dist/schedule-extractor.d.ts +2 -80
- package/dist/schedule-extractor.d.ts.map +1 -1
- package/dist/schedule-extractor.js +100 -225
- package/dist/schedule-extractor.js.map +1 -1
- package/dist/schedule-serializer-builders.d.ts +28 -0
- package/dist/schedule-serializer-builders.d.ts.map +1 -0
- package/dist/schedule-serializer-builders.js +163 -0
- package/dist/schedule-serializer-builders.js.map +1 -0
- package/dist/schedule-serializer.d.ts +6 -0
- package/dist/schedule-serializer.d.ts.map +1 -1
- package/dist/schedule-serializer.js +26 -165
- package/dist/schedule-serializer.js.map +1 -1
- package/dist/schedule-types.d.ts +211 -0
- package/dist/schedule-types.d.ts.map +1 -0
- package/dist/schedule-types.js +221 -0
- package/dist/schedule-types.js.map +1 -0
- package/dist/spatial-hierarchy-ambiguity.d.ts +39 -0
- package/dist/spatial-hierarchy-ambiguity.d.ts.map +1 -0
- package/dist/spatial-hierarchy-ambiguity.js +25 -0
- package/dist/spatial-hierarchy-ambiguity.js.map +1 -0
- package/dist/spatial-hierarchy-attributes.d.ts +54 -0
- package/dist/spatial-hierarchy-attributes.d.ts.map +1 -0
- package/dist/spatial-hierarchy-attributes.js +145 -0
- package/dist/spatial-hierarchy-attributes.js.map +1 -0
- package/dist/spatial-hierarchy-builder.d.ts +0 -30
- package/dist/spatial-hierarchy-builder.d.ts.map +1 -1
- package/dist/spatial-hierarchy-builder.js +45 -167
- package/dist/spatial-hierarchy-builder.js.map +1 -1
- package/dist/spatial-hierarchy-canonical-parent.d.ts +52 -2
- package/dist/spatial-hierarchy-canonical-parent.d.ts.map +1 -1
- package/dist/spatial-hierarchy-canonical-parent.js +153 -4
- package/dist/spatial-hierarchy-canonical-parent.js.map +1 -1
- package/dist/step-lexing.d.ts +1 -1
- package/dist/step-lexing.d.ts.map +1 -1
- package/dist/step-lexing.js +1 -56
- package/dist/step-lexing.js.map +1 -1
- package/dist/step-record-boundary.d.ts +28 -0
- package/dist/step-record-boundary.d.ts.map +1 -0
- package/dist/step-record-boundary.js +108 -0
- package/dist/step-record-boundary.js.map +1 -0
- package/dist/step-record-boundary.vectors.d.ts +58 -0
- package/dist/step-record-boundary.vectors.d.ts.map +1 -0
- package/dist/step-record-boundary.vectors.js +80 -0
- package/dist/step-record-boundary.vectors.js.map +1 -0
- package/dist/structural-extractor.d.ts +9 -0
- package/dist/structural-extractor.d.ts.map +1 -0
- package/dist/structural-extractor.js +310 -0
- package/dist/structural-extractor.js.map +1 -0
- package/dist/structural-load-extractor.d.ts +147 -0
- package/dist/structural-load-extractor.d.ts.map +1 -0
- package/dist/structural-load-extractor.js +178 -0
- package/dist/structural-load-extractor.js.map +1 -0
- package/dist/structural-step-values.d.ts +51 -0
- package/dist/structural-step-values.d.ts.map +1 -0
- package/dist/structural-step-values.js +109 -0
- package/dist/structural-step-values.js.map +1 -0
- package/dist/structural-types.d.ts +145 -0
- package/dist/structural-types.d.ts.map +1 -0
- package/dist/structural-types.js +5 -0
- package/dist/structural-types.js.map +1 -0
- package/dist/tokenizer.d.ts +11 -5
- package/dist/tokenizer.d.ts.map +1 -1
- package/dist/tokenizer.js +75 -21
- package/dist/tokenizer.js.map +1 -1
- package/dist/wasm-init-retry.d.ts +6 -42
- package/dist/wasm-init-retry.d.ts.map +1 -1
- package/dist/wasm-init-retry.js +6 -99
- package/dist/wasm-init-retry.js.map +1 -1
- package/dist/wasm-panic-forward.d.ts +7 -63
- package/dist/wasm-panic-forward.d.ts.map +1 -1
- package/dist/wasm-panic-forward.js +7 -100
- package/dist/wasm-panic-forward.js.map +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* Cost (5D) extractor — parses IfcCostItem, IfcCostValue, IfcCostSchedule,
|
|
6
|
+
* IfcRelNests and IfcRelAssignsToControl from a parsed IfcDataStore into a
|
|
7
|
+
* normalized CostExtraction. Structure mirrors `schedule-extractor.ts`
|
|
8
|
+
* (schedule/task hierarchy -> cost/cost-item hierarchy).
|
|
9
|
+
*
|
|
10
|
+
* Relationship wiring, verified against `packages/codegen/schemas/IFC4_ADD2_TC1.exp`
|
|
11
|
+
* / `IFC4X3.exp` (identical in both):
|
|
12
|
+
*
|
|
13
|
+
* - `IfcControl` (the supertype of both `IfcCostItem` and `IfcCostSchedule`)
|
|
14
|
+
* declares `INVERSE Controls : SET [0:?] OF IfcRelAssignsToControl FOR
|
|
15
|
+
* RelatingControl` — `IfcRelAssignsToControl` is the ONLY relationship
|
|
16
|
+
* that can target a Control as `RelatingControl`, so it is necessarily
|
|
17
|
+
* what binds both "schedule controls cost items" and "cost item controls
|
|
18
|
+
* the objects it prices" — there is no separate relationship analogous to
|
|
19
|
+
* `IfcRelAssignsToProcess` for cost. Which of the two a given
|
|
20
|
+
* `IfcRelAssignsToControl` instance expresses is told apart here by
|
|
21
|
+
* what its `RelatingControl` expressId resolves to (a cost schedule or
|
|
22
|
+
* a cost item), not by anything the schema itself distinguishes.
|
|
23
|
+
* - Cost item breakdown (parent/child `IfcCostItem` nesting) uses
|
|
24
|
+
* `IfcRelNests` (`RelatingObject`/`RelatedObjects : IfcObjectDefinition`,
|
|
25
|
+
* which `IfcCostItem` satisfies via `IfcControl -> IfcObject ->
|
|
26
|
+
* IfcObjectDefinition`) — the same relationship `schedule-extractor.ts`
|
|
27
|
+
* uses for task hierarchy. The EXPRESS schema does not constrain this by
|
|
28
|
+
* a WHERE rule (nothing stops `IfcRelNests` from nesting unrelated
|
|
29
|
+
* objects), so this is the domain convention this extractor follows, not
|
|
30
|
+
* a schema-enforced fact — reported explicitly rather than asserted as
|
|
31
|
+
* certain.
|
|
32
|
+
*
|
|
33
|
+
* IFC2X3's `IfcCostItem` has NO attributes at all (`SUBTYPE OF (IfcControl)`
|
|
34
|
+
* only — no PredefinedType/CostValues/CostQuantities), so those fields are
|
|
35
|
+
* always `undefined` for a 2X3 file; this is schema-version-gated below, not
|
|
36
|
+
* inferred from an empty read. IFC2X3's `IfcCostSchedule` DOES carry
|
|
37
|
+
* Status/SubmittedOn/UpdateDate/PredefinedType, at different slots and with
|
|
38
|
+
* entity-valued dates — read through `cost-schedule-2x3.ts`.
|
|
39
|
+
*/
|
|
40
|
+
import { EntityExtractor } from './entity-extractor.js';
|
|
41
|
+
import { collectQuantitiesFromRefs } from './quantity-collect.js';
|
|
42
|
+
import { resolveUnitByRef } from './project-units.js';
|
|
43
|
+
import { COST_SCHEDULE_ATTR_2X3, resolveDateTimeSelect2x3 } from './cost-schedule-2x3.js';
|
|
44
|
+
/** Flattened IFC4/IFC4X3 STEP attribute indices for IfcCostItem. */
|
|
45
|
+
const COST_ITEM_ATTR = {
|
|
46
|
+
GlobalId: 0,
|
|
47
|
+
Name: 2,
|
|
48
|
+
Description: 3,
|
|
49
|
+
ObjectType: 4,
|
|
50
|
+
Identification: 5,
|
|
51
|
+
PredefinedType: 6,
|
|
52
|
+
CostValues: 7,
|
|
53
|
+
CostQuantities: 8,
|
|
54
|
+
};
|
|
55
|
+
const COST_SCHEDULE_ATTR = {
|
|
56
|
+
GlobalId: 0,
|
|
57
|
+
Name: 2,
|
|
58
|
+
Description: 3,
|
|
59
|
+
ObjectType: 4,
|
|
60
|
+
Identification: 5,
|
|
61
|
+
PredefinedType: 6,
|
|
62
|
+
Status: 7,
|
|
63
|
+
SubmittedOn: 8,
|
|
64
|
+
UpdateDate: 9,
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* IfcAppliedValue attribute slots (IfcCostValue adds no attributes of its
|
|
68
|
+
* own). Slot 3, `UnitBasis : OPTIONAL IfcMeasureWithUnit`, is what tells a
|
|
69
|
+
* RATE ("$85 per hour") apart from a flat total ("$5,000") — read via
|
|
70
|
+
* `extractUnitBasis` below, not skipped.
|
|
71
|
+
*/
|
|
72
|
+
const COST_VALUE_ATTR = {
|
|
73
|
+
Name: 0,
|
|
74
|
+
Description: 1,
|
|
75
|
+
AppliedValue: 2,
|
|
76
|
+
UnitBasis: 3,
|
|
77
|
+
ApplicableDate: 4,
|
|
78
|
+
FixedUntilDate: 5,
|
|
79
|
+
Category: 6,
|
|
80
|
+
Condition: 7,
|
|
81
|
+
ArithmeticOperator: 8,
|
|
82
|
+
Components: 9,
|
|
83
|
+
};
|
|
84
|
+
const REL_NESTS_ATTR = { RelatingObject: 4, RelatedObjects: 5 };
|
|
85
|
+
const REL_ASSIGNS_TO_CONTROL_ATTR = { RelatedObjects: 4, RelatingControl: 6 };
|
|
86
|
+
function asString(v) {
|
|
87
|
+
if (typeof v === 'string' && v.length > 0)
|
|
88
|
+
return v;
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
function asEnum(v) {
|
|
92
|
+
if (typeof v !== 'string' || v.length === 0)
|
|
93
|
+
return undefined;
|
|
94
|
+
const match = v.match(/^\.([A-Z_]+)\.$/);
|
|
95
|
+
return match ? match[1] : undefined;
|
|
96
|
+
}
|
|
97
|
+
function asRef(v) {
|
|
98
|
+
if (typeof v === 'number' && Number.isInteger(v) && v > 0)
|
|
99
|
+
return v;
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
function asRefList(v) {
|
|
103
|
+
if (!Array.isArray(v))
|
|
104
|
+
return [];
|
|
105
|
+
const out = [];
|
|
106
|
+
for (const x of v) {
|
|
107
|
+
const id = asRef(x);
|
|
108
|
+
if (id !== undefined)
|
|
109
|
+
out.push(id);
|
|
110
|
+
}
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* `AppliedValue` is an `IfcAppliedValueSelect`. A resolved measure reads as a
|
|
115
|
+
* typed pair `['IFCMONETARYMEASURE', 500]` (same shape `extractLagTimeSeconds`
|
|
116
|
+
* in `schedule-extractor.ts` unwraps for `IfcTimeOrRatioSelect`); a plain
|
|
117
|
+
* number is accepted too, since not every parse path wraps a select. Any
|
|
118
|
+
* other select member (e.g. a table or measure-with-unit reference) is left
|
|
119
|
+
* unresolved rather than guessed at.
|
|
120
|
+
*/
|
|
121
|
+
function asAppliedValueNumber(v) {
|
|
122
|
+
if (typeof v === 'number' && Number.isFinite(v))
|
|
123
|
+
return v;
|
|
124
|
+
if (Array.isArray(v) && v.length === 2) {
|
|
125
|
+
const inner = v[1];
|
|
126
|
+
if (typeof inner === 'number' && Number.isFinite(inner))
|
|
127
|
+
return inner;
|
|
128
|
+
if (typeof inner === 'string') {
|
|
129
|
+
const n = parseFloat(inner);
|
|
130
|
+
if (Number.isFinite(n))
|
|
131
|
+
return n;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return undefined;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Resolve `IfcAppliedValue.UnitBasis` (slot 3, `OPTIONAL IfcMeasureWithUnit`)
|
|
138
|
+
* into the minimal shape that answers "is this a rate or a total?" —
|
|
139
|
+
* `undefined` when `UnitBasis` is absent or its reference is broken;
|
|
140
|
+
* otherwise an object whose mere presence marks the owning `CostValueInfo` as
|
|
141
|
+
* a rate, with `valueComponent`/`unitSymbol` individually `undefined` when
|
|
142
|
+
* that half of `IfcMeasureWithUnit` could not itself be resolved (see
|
|
143
|
+
* {@link CostValueUnitBasis}'s doc comment in `cost-types.ts`).
|
|
144
|
+
*
|
|
145
|
+
* `IfcMeasureWithUnit` (`ValueComponent : IfcValue`, `UnitComponent :
|
|
146
|
+
* IfcUnit`) — both SELECT types, so each is resolved independently:
|
|
147
|
+
* - `ValueComponent` reuses `asAppliedValueNumber`, the same resolution
|
|
148
|
+
* `AppliedValue` above uses for its own `IfcAppliedValueSelect`.
|
|
149
|
+
* - `UnitComponent` reuses `resolveUnitByRef` (shared with
|
|
150
|
+
* `IfcPhysicalSimpleQuantity.Unit` in `quantity-collect.ts`), NOT
|
|
151
|
+
* `quantitySiScale`'s project-unit-fallback machinery: `IfcMeasureWithUnit`
|
|
152
|
+
* is not an `IfcPhysicalQuantity`, `UnitComponent` is not `OPTIONAL`
|
|
153
|
+
* within it, and there is no containing project unit to fall back to — the
|
|
154
|
+
* reference resolves or it does not.
|
|
155
|
+
*/
|
|
156
|
+
function extractUnitBasis(extractor, store, unitBasisRef) {
|
|
157
|
+
if (unitBasisRef === undefined)
|
|
158
|
+
return undefined;
|
|
159
|
+
const ref = store.entityIndex.byId.get(unitBasisRef);
|
|
160
|
+
if (!ref)
|
|
161
|
+
return undefined;
|
|
162
|
+
const entity = extractor.extractEntity(ref);
|
|
163
|
+
if (!entity || entity.type.toUpperCase() !== 'IFCMEASUREWITHUNIT')
|
|
164
|
+
return undefined;
|
|
165
|
+
const a = entity.attributes || [];
|
|
166
|
+
const unitRef = asRef(a[1]);
|
|
167
|
+
const unit = unitRef !== undefined ? resolveUnitByRef(extractor, store.entityIndex, unitRef) : null;
|
|
168
|
+
return {
|
|
169
|
+
valueComponent: asAppliedValueNumber(a[0]),
|
|
170
|
+
unitSymbol: unit?.resolved.symbol,
|
|
171
|
+
unitSiScale: unit?.resolved.siScale,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
const MAX_COST_VALUE_DEPTH = 20;
|
|
175
|
+
function extractCostValue(extractor, store, valueId, depth, visiting) {
|
|
176
|
+
if (depth > MAX_COST_VALUE_DEPTH || visiting.has(valueId))
|
|
177
|
+
return undefined;
|
|
178
|
+
const ref = store.entityIndex.byId.get(valueId);
|
|
179
|
+
if (!ref)
|
|
180
|
+
return undefined;
|
|
181
|
+
const entity = extractor.extractEntity(ref);
|
|
182
|
+
if (!entity)
|
|
183
|
+
return undefined;
|
|
184
|
+
if (entity.type.toUpperCase() !== 'IFCCOSTVALUE')
|
|
185
|
+
return undefined;
|
|
186
|
+
const a = entity.attributes || [];
|
|
187
|
+
visiting.add(valueId);
|
|
188
|
+
const componentIds = asRefList(a[COST_VALUE_ATTR.Components]);
|
|
189
|
+
const components = componentIds.length
|
|
190
|
+
? componentIds
|
|
191
|
+
.map((id) => extractCostValue(extractor, store, id, depth + 1, visiting))
|
|
192
|
+
.filter((c) => c !== undefined)
|
|
193
|
+
: undefined;
|
|
194
|
+
visiting.delete(valueId);
|
|
195
|
+
return {
|
|
196
|
+
name: asString(a[COST_VALUE_ATTR.Name]),
|
|
197
|
+
description: asString(a[COST_VALUE_ATTR.Description]),
|
|
198
|
+
appliedValue: asAppliedValueNumber(a[COST_VALUE_ATTR.AppliedValue]),
|
|
199
|
+
unitBasis: extractUnitBasis(extractor, store, asRef(a[COST_VALUE_ATTR.UnitBasis])),
|
|
200
|
+
applicableDate: asString(a[COST_VALUE_ATTR.ApplicableDate]),
|
|
201
|
+
fixedUntilDate: asString(a[COST_VALUE_ATTR.FixedUntilDate]),
|
|
202
|
+
category: asString(a[COST_VALUE_ATTR.Category]),
|
|
203
|
+
condition: asString(a[COST_VALUE_ATTR.Condition]),
|
|
204
|
+
arithmeticOperator: asEnum(a[COST_VALUE_ATTR.ArithmeticOperator]),
|
|
205
|
+
...(components && components.length ? { components } : {}),
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function extractCostValues(extractor, store, refs) {
|
|
209
|
+
const ids = asRefList(refs);
|
|
210
|
+
if (ids.length === 0)
|
|
211
|
+
return undefined;
|
|
212
|
+
const visiting = new Set();
|
|
213
|
+
const values = ids
|
|
214
|
+
.map((id) => extractCostValue(extractor, store, id, 0, visiting))
|
|
215
|
+
.filter((v) => v !== undefined);
|
|
216
|
+
return values.length ? values : undefined;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Extract all costing data from a parsed IFC store.
|
|
220
|
+
*
|
|
221
|
+
* Walks every IfcCostItem / IfcCostSchedule / IfcRelNests /
|
|
222
|
+
* IfcRelAssignsToControl entity and assembles a connected CostExtraction.
|
|
223
|
+
*/
|
|
224
|
+
export function extractCostOnDemand(store) {
|
|
225
|
+
if (!store.source?.length) {
|
|
226
|
+
return { costSchedules: [], costItems: [], hasCost: false };
|
|
227
|
+
}
|
|
228
|
+
const byType = store.entityIndex.byType;
|
|
229
|
+
const costItemIds = byType.get('IFCCOSTITEM') ?? [];
|
|
230
|
+
const costScheduleIds = byType.get('IFCCOSTSCHEDULE') ?? [];
|
|
231
|
+
const relNestsIds = byType.get('IFCRELNESTS') ?? [];
|
|
232
|
+
const relAssignsControlIds = byType.get('IFCRELASSIGNSTOCONTROL') ?? [];
|
|
233
|
+
if (costItemIds.length + costScheduleIds.length === 0) {
|
|
234
|
+
return { costSchedules: [], costItems: [], hasCost: false };
|
|
235
|
+
}
|
|
236
|
+
const extractor = new EntityExtractor(store.source);
|
|
237
|
+
// IFC2X3's IfcCostItem has no attributes at all — schema-version-gated,
|
|
238
|
+
// not inferred from a missing value (see module doc comment).
|
|
239
|
+
const schemaIs2x3 = store.schemaVersion === 'IFC2X3';
|
|
240
|
+
const costItemByExpressId = new Map();
|
|
241
|
+
// Pass 1: base IfcCostItem records.
|
|
242
|
+
for (const expressId of costItemIds) {
|
|
243
|
+
const ref = store.entityIndex.byId.get(expressId);
|
|
244
|
+
if (!ref)
|
|
245
|
+
continue;
|
|
246
|
+
const entity = extractor.extractEntity(ref);
|
|
247
|
+
if (!entity)
|
|
248
|
+
continue;
|
|
249
|
+
const a = entity.attributes || [];
|
|
250
|
+
const globalId = asString(a[COST_ITEM_ATTR.GlobalId]) ?? '';
|
|
251
|
+
const item = {
|
|
252
|
+
expressId,
|
|
253
|
+
globalId,
|
|
254
|
+
name: asString(a[COST_ITEM_ATTR.Name]) ?? '',
|
|
255
|
+
predefinedType: schemaIs2x3 ? undefined : asEnum(a[COST_ITEM_ATTR.PredefinedType]),
|
|
256
|
+
costValues: schemaIs2x3
|
|
257
|
+
? undefined
|
|
258
|
+
: extractCostValues(extractor, store, a[COST_ITEM_ATTR.CostValues]),
|
|
259
|
+
costQuantities: schemaIs2x3
|
|
260
|
+
? undefined
|
|
261
|
+
: (() => {
|
|
262
|
+
const qtys = collectQuantitiesFromRefs(store, extractor, a[COST_ITEM_ATTR.CostQuantities]);
|
|
263
|
+
return qtys.length ? qtys : undefined;
|
|
264
|
+
})(),
|
|
265
|
+
childGlobalIds: [],
|
|
266
|
+
productExpressIds: [],
|
|
267
|
+
productGlobalIds: [],
|
|
268
|
+
controllingScheduleGlobalIds: [],
|
|
269
|
+
};
|
|
270
|
+
costItemByExpressId.set(expressId, item);
|
|
271
|
+
}
|
|
272
|
+
// Pass 2: IfcRelNests — cost item breakdown hierarchy.
|
|
273
|
+
for (const relId of relNestsIds) {
|
|
274
|
+
const ref = store.entityIndex.byId.get(relId);
|
|
275
|
+
if (!ref)
|
|
276
|
+
continue;
|
|
277
|
+
const entity = extractor.extractEntity(ref);
|
|
278
|
+
if (!entity)
|
|
279
|
+
continue;
|
|
280
|
+
const a = entity.attributes || [];
|
|
281
|
+
const parent = asRef(a[REL_NESTS_ATTR.RelatingObject]);
|
|
282
|
+
const children = asRefList(a[REL_NESTS_ATTR.RelatedObjects]);
|
|
283
|
+
if (parent === undefined)
|
|
284
|
+
continue;
|
|
285
|
+
const parentItem = costItemByExpressId.get(parent);
|
|
286
|
+
if (!parentItem)
|
|
287
|
+
continue; // nesting over non-cost-item entities — ignore
|
|
288
|
+
for (const childId of children) {
|
|
289
|
+
const childItem = costItemByExpressId.get(childId);
|
|
290
|
+
if (!childItem)
|
|
291
|
+
continue;
|
|
292
|
+
parentItem.childGlobalIds.push(childItem.globalId);
|
|
293
|
+
if (!childItem.parentGlobalId) {
|
|
294
|
+
childItem.parentGlobalId = parentItem.globalId;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
// Pass 3: extract cost schedules.
|
|
299
|
+
const costSchedules = [];
|
|
300
|
+
const scheduleByExpressId = new Map();
|
|
301
|
+
for (const expressId of costScheduleIds) {
|
|
302
|
+
const ref = store.entityIndex.byId.get(expressId);
|
|
303
|
+
if (!ref)
|
|
304
|
+
continue;
|
|
305
|
+
const entity = extractor.extractEntity(ref);
|
|
306
|
+
if (!entity)
|
|
307
|
+
continue;
|
|
308
|
+
const a = entity.attributes || [];
|
|
309
|
+
const globalId = asString(a[COST_SCHEDULE_ATTR.GlobalId]) ?? '';
|
|
310
|
+
const info = {
|
|
311
|
+
expressId,
|
|
312
|
+
globalId,
|
|
313
|
+
name: asString(a[COST_SCHEDULE_ATTR.Name]) ?? '',
|
|
314
|
+
// IFC2X3 lays the schedule out differently (see cost-schedule-2x3.ts).
|
|
315
|
+
predefinedType: asEnum(a[schemaIs2x3 ? COST_SCHEDULE_ATTR_2X3.PredefinedType : COST_SCHEDULE_ATTR.PredefinedType]),
|
|
316
|
+
status: asString(a[schemaIs2x3 ? COST_SCHEDULE_ATTR_2X3.Status : COST_SCHEDULE_ATTR.Status]),
|
|
317
|
+
submittedOn: schemaIs2x3
|
|
318
|
+
? resolveDateTimeSelect2x3(extractor, store, a[COST_SCHEDULE_ATTR_2X3.SubmittedOn])
|
|
319
|
+
: asString(a[COST_SCHEDULE_ATTR.SubmittedOn]),
|
|
320
|
+
updateDate: schemaIs2x3
|
|
321
|
+
? resolveDateTimeSelect2x3(extractor, store, a[COST_SCHEDULE_ATTR_2X3.UpdateDate])
|
|
322
|
+
: asString(a[COST_SCHEDULE_ATTR.UpdateDate]),
|
|
323
|
+
costItemGlobalIds: [],
|
|
324
|
+
};
|
|
325
|
+
costSchedules.push(info);
|
|
326
|
+
scheduleByExpressId.set(expressId, info);
|
|
327
|
+
}
|
|
328
|
+
// Pass 4: IfcRelAssignsToControl — schedule->cost-item assignment AND
|
|
329
|
+
// cost-item->object (product) assignment, told apart by what
|
|
330
|
+
// RelatingControl resolves to (see module doc comment).
|
|
331
|
+
for (const relId of relAssignsControlIds) {
|
|
332
|
+
const ref = store.entityIndex.byId.get(relId);
|
|
333
|
+
if (!ref)
|
|
334
|
+
continue;
|
|
335
|
+
const entity = extractor.extractEntity(ref);
|
|
336
|
+
if (!entity)
|
|
337
|
+
continue;
|
|
338
|
+
const a = entity.attributes || [];
|
|
339
|
+
const controlId = asRef(a[REL_ASSIGNS_TO_CONTROL_ATTR.RelatingControl]);
|
|
340
|
+
if (controlId === undefined)
|
|
341
|
+
continue;
|
|
342
|
+
const relatedIds = asRefList(a[REL_ASSIGNS_TO_CONTROL_ATTR.RelatedObjects]);
|
|
343
|
+
const schedule = scheduleByExpressId.get(controlId);
|
|
344
|
+
if (schedule) {
|
|
345
|
+
for (const objId of relatedIds) {
|
|
346
|
+
const item = costItemByExpressId.get(objId);
|
|
347
|
+
if (!item)
|
|
348
|
+
continue;
|
|
349
|
+
schedule.costItemGlobalIds.push(item.globalId);
|
|
350
|
+
item.controllingScheduleGlobalIds.push(schedule.globalId);
|
|
351
|
+
}
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
const costItem = costItemByExpressId.get(controlId);
|
|
355
|
+
if (costItem) {
|
|
356
|
+
for (const productId of relatedIds) {
|
|
357
|
+
const gid = store.entities?.getGlobalId?.(productId) ?? undefined;
|
|
358
|
+
costItem.productExpressIds.push(productId);
|
|
359
|
+
costItem.productGlobalIds.push(gid ?? '');
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
return {
|
|
364
|
+
costSchedules,
|
|
365
|
+
costItems: Array.from(costItemByExpressId.values()),
|
|
366
|
+
hasCost: true,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
//# sourceMappingURL=cost-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost-extractor.js","sourceRoot":"","sources":["../src/cost-extractor.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAS1F,oEAAoE;AACpE,MAAM,cAAc,GAAG;IACrB,QAAQ,EAAE,CAAC;IAC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,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBAC3C,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,aAAa;QACb,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,CAAC;QACnD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IFC2X3 `IfcCostSchedule` attribute layout, used by `cost-extractor.ts`.
|
|
3
|
+
*
|
|
4
|
+
* In IFC2X3 `IfcControl` adds no attributes to `IfcObject`, so the schedule's
|
|
5
|
+
* own attributes start at slot 5 (IFC4 inserts `Identification` there and
|
|
6
|
+
* reorders the rest):
|
|
7
|
+
*
|
|
8
|
+
* 5 SubmittedBy, 6 PreparedBy, 7 SubmittedOn, 8 Status, 9 TargetUsers,
|
|
9
|
+
* 10 UpdateDate, 11 ID, 12 PredefinedType
|
|
10
|
+
*
|
|
11
|
+
* `SubmittedOn`/`UpdateDate` are `IfcDateTimeSelect` — a reference to an
|
|
12
|
+
* `IfcCalendarDate` or `IfcDateAndTime` entity, not the IFC4 ISO string — so
|
|
13
|
+
* they are resolved here into the same `YYYY-MM-DD[THH:MM:SS]` shape the IFC4
|
|
14
|
+
* path returns.
|
|
15
|
+
*/
|
|
16
|
+
import type { EntityExtractor } from './entity-extractor.js';
|
|
17
|
+
import type { IfcDataStore } from './columnar-parser.js';
|
|
18
|
+
export declare const COST_SCHEDULE_ATTR_2X3: {
|
|
19
|
+
readonly SubmittedOn: 7;
|
|
20
|
+
readonly Status: 8;
|
|
21
|
+
readonly UpdateDate: 10;
|
|
22
|
+
readonly ID: 11;
|
|
23
|
+
readonly PredefinedType: 12;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Resolve an IFC2X3 `IfcDateTimeSelect` attribute (an entity reference) to an
|
|
27
|
+
* ISO-like string; `undefined` for `$`, a non-reference, or an unresolvable
|
|
28
|
+
* / unexpected target type.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveDateTimeSelect2x3(extractor: EntityExtractor, store: IfcDataStore, value: unknown): string | undefined;
|
|
31
|
+
//# sourceMappingURL=cost-schedule-2x3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost-schedule-2x3.d.ts","sourceRoot":"","sources":["../src/cost-schedule-2x3.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,eAAO,MAAM,sBAAsB;;;;;;CAMzB,CAAC;AAsBX;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,OAAO,GACb,MAAM,GAAG,SAAS,CAmBpB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
+
/**
|
|
5
|
+
* IFC2X3 `IfcCostSchedule` attribute layout, used by `cost-extractor.ts`.
|
|
6
|
+
*
|
|
7
|
+
* In IFC2X3 `IfcControl` adds no attributes to `IfcObject`, so the schedule's
|
|
8
|
+
* own attributes start at slot 5 (IFC4 inserts `Identification` there and
|
|
9
|
+
* reorders the rest):
|
|
10
|
+
*
|
|
11
|
+
* 5 SubmittedBy, 6 PreparedBy, 7 SubmittedOn, 8 Status, 9 TargetUsers,
|
|
12
|
+
* 10 UpdateDate, 11 ID, 12 PredefinedType
|
|
13
|
+
*
|
|
14
|
+
* `SubmittedOn`/`UpdateDate` are `IfcDateTimeSelect` — a reference to an
|
|
15
|
+
* `IfcCalendarDate` or `IfcDateAndTime` entity, not the IFC4 ISO string — so
|
|
16
|
+
* they are resolved here into the same `YYYY-MM-DD[THH:MM:SS]` shape the IFC4
|
|
17
|
+
* path returns.
|
|
18
|
+
*/
|
|
19
|
+
export const COST_SCHEDULE_ATTR_2X3 = {
|
|
20
|
+
SubmittedOn: 7,
|
|
21
|
+
Status: 8,
|
|
22
|
+
UpdateDate: 10,
|
|
23
|
+
ID: 11,
|
|
24
|
+
PredefinedType: 12,
|
|
25
|
+
};
|
|
26
|
+
function pad2(n) {
|
|
27
|
+
return n < 10 ? `0${n}` : String(n);
|
|
28
|
+
}
|
|
29
|
+
function calendarDate(a) {
|
|
30
|
+
// IfcCalendarDate(DayComponent, MonthComponent, YearComponent)
|
|
31
|
+
const [day, month, year] = a;
|
|
32
|
+
if (typeof day !== 'number' || typeof month !== 'number' || typeof year !== 'number')
|
|
33
|
+
return undefined;
|
|
34
|
+
return `${year}-${pad2(month)}-${pad2(day)}`;
|
|
35
|
+
}
|
|
36
|
+
function localTime(a) {
|
|
37
|
+
// IfcLocalTime(HourComponent, MinuteComponent?, SecondComponent?, Zone?, DaylightSavingOffset?)
|
|
38
|
+
const [hour, minute, second] = a;
|
|
39
|
+
if (typeof hour !== 'number')
|
|
40
|
+
return undefined;
|
|
41
|
+
const m = typeof minute === 'number' ? minute : 0;
|
|
42
|
+
const s = typeof second === 'number' ? Math.floor(second) : 0;
|
|
43
|
+
return `${pad2(hour)}:${pad2(m)}:${pad2(s)}`;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolve an IFC2X3 `IfcDateTimeSelect` attribute (an entity reference) to an
|
|
47
|
+
* ISO-like string; `undefined` for `$`, a non-reference, or an unresolvable
|
|
48
|
+
* / unexpected target type.
|
|
49
|
+
*/
|
|
50
|
+
export function resolveDateTimeSelect2x3(extractor, store, value) {
|
|
51
|
+
if (typeof value !== 'number' || !Number.isInteger(value) || value <= 0)
|
|
52
|
+
return undefined;
|
|
53
|
+
const ref = store.entityIndex.byId.get(value);
|
|
54
|
+
if (!ref)
|
|
55
|
+
return undefined;
|
|
56
|
+
const entity = extractor.extractEntity(ref);
|
|
57
|
+
if (!entity)
|
|
58
|
+
return undefined;
|
|
59
|
+
const a = entity.attributes || [];
|
|
60
|
+
const type = ref.type.toUpperCase();
|
|
61
|
+
if (type === 'IFCCALENDARDATE')
|
|
62
|
+
return calendarDate(a);
|
|
63
|
+
if (type === 'IFCDATEANDTIME') {
|
|
64
|
+
// IfcDateAndTime(DateComponent : IfcCalendarDate, TimeComponent : IfcLocalTime)
|
|
65
|
+
const date = resolveDateTimeSelect2x3(extractor, store, a[0]);
|
|
66
|
+
if (date === undefined)
|
|
67
|
+
return undefined;
|
|
68
|
+
const timeRef = typeof a[1] === 'number' ? store.entityIndex.byId.get(a[1]) : undefined;
|
|
69
|
+
const time = timeRef ? extractor.extractEntity(timeRef) : null;
|
|
70
|
+
const clock = time ? localTime(time.attributes || []) : undefined;
|
|
71
|
+
return clock === undefined ? date : `${date}T${clock}`;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=cost-schedule-2x3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost-schedule-2x3.js","sourceRoot":"","sources":["../src/cost-schedule-2x3.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAC/D;;;;;;;;;;;;;;GAcG;AAKH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,WAAW,EAAE,CAAC;IACd,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,EAAE;IACd,EAAE,EAAE,EAAE;IACN,cAAc,EAAE,EAAE;CACV,CAAC;AAEX,SAAS,IAAI,CAAC,CAAS;IACrB,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,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**
|
|
2
|
+
* Read-model types for the cost (5D) extractor. See `cost-extractor.ts` for
|
|
3
|
+
* the extraction logic and the relationship-wiring rationale.
|
|
4
|
+
*/
|
|
5
|
+
import type { CollectedQuantity } from './quantity-collect.js';
|
|
6
|
+
export type { CollectedQuantity };
|
|
7
|
+
/**
|
|
8
|
+
* `UnitBasis` resolved (`IfcAppliedValue.UnitBasis : OPTIONAL
|
|
9
|
+
* IfcMeasureWithUnit`, schema slot 3 in `IFC4_ADD2_TC1.exp` / `IFC4X3.exp` /
|
|
10
|
+
* `IFC2X3_TC1.exp` alike). Present exactly when the source declared a
|
|
11
|
+
* `UnitBasis` that resolves to an `IFCMEASUREWITHUNIT` entity — that presence
|
|
12
|
+
* alone is what marks this `CostValueInfo` as a RATE ("$85 per hour") rather
|
|
13
|
+
* than a flat total ("$5,000"), even when `valueComponent`/`unitSymbol` below
|
|
14
|
+
* could not themselves be resolved (e.g. `UnitComponent` selects an
|
|
15
|
+
* `IfcContextDependentUnit`, which carries no SI conversion and
|
|
16
|
+
* `resolveUnitByRef` does not resolve). `undefined` on `CostValueInfo` when
|
|
17
|
+
* `UnitBasis` itself is absent or its reference is broken — matching this
|
|
18
|
+
* module's absent-vs-unresolved convention for `costValues`/`parentGlobalId`.
|
|
19
|
+
*/
|
|
20
|
+
export interface CostValueUnitBasis {
|
|
21
|
+
/** `ValueComponent`, e.g. `1` in "per 1 hour". `undefined` when the
|
|
22
|
+
* `IfcValue` select member is not a plain numeric measure this reader
|
|
23
|
+
* resolves (same resolution `appliedValue` below uses). */
|
|
24
|
+
valueComponent?: number;
|
|
25
|
+
/** `UnitComponent`'s display symbol, e.g. `"h"`, `"m²"`. `undefined` when
|
|
26
|
+
* `resolveUnitByRef` does not resolve the referenced `IfcUnit` member. */
|
|
27
|
+
unitSymbol?: string;
|
|
28
|
+
/** SI scale factor for `unitSymbol`, when resolved. */
|
|
29
|
+
unitSiScale?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One `IfcCostValue` (a subtype of `IfcAppliedValue` that adds no attributes
|
|
33
|
+
* of its own — `packages/codegen/schemas/IFC4_ADD2_TC1.exp` /
|
|
34
|
+
* `IFC4X3.exp`: `ENTITY IfcCostValue SUBTYPE OF (IfcAppliedValue); END_ENTITY;`).
|
|
35
|
+
* Every field below is `IfcAppliedValue`'s own, per its EXPRESS definition.
|
|
36
|
+
*/
|
|
37
|
+
export interface CostValueInfo {
|
|
38
|
+
name?: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
/**
|
|
41
|
+
* `AppliedValue` is an `IfcAppliedValueSelect` — in practice almost always
|
|
42
|
+
* an `IfcMonetaryMeasure`/`IfcNumericMeasure`/`IfcRatioMeasure` typed
|
|
43
|
+
* numeric wrapper. Resolved to a plain number when the wrapped value reads
|
|
44
|
+
* as one; left `undefined` when it selects a non-numeric member (e.g. an
|
|
45
|
+
* `IfcMeasureWithUnit` reference) this extractor does not resolve.
|
|
46
|
+
*/
|
|
47
|
+
appliedValue?: number;
|
|
48
|
+
/** See {@link CostValueUnitBasis} — distinguishes a rate from a flat total. */
|
|
49
|
+
unitBasis?: CostValueUnitBasis;
|
|
50
|
+
applicableDate?: string;
|
|
51
|
+
fixedUntilDate?: string;
|
|
52
|
+
category?: string;
|
|
53
|
+
condition?: string;
|
|
54
|
+
arithmeticOperator?: string;
|
|
55
|
+
/** Nested `IfcCostValue` components (`Components : OPTIONAL LIST [1:?] OF IfcAppliedValue`). */
|
|
56
|
+
components?: CostValueInfo[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* One `IfcCostItem`. Mirrors `ScheduleTaskInfo`'s shape in `schedule-extractor.ts`.
|
|
60
|
+
*
|
|
61
|
+
* `costQuantities` is `undefined` when `CostQuantities` is absent (the
|
|
62
|
+
* schema's `LIST [1:?]` forbids an empty-but-declared list, so `undefined`
|
|
63
|
+
* is the only "nothing here" state) or when every referenced quantity failed
|
|
64
|
+
* to resolve. It is never a fallback to a product's `Qto_` quantities — see
|
|
65
|
+
* `cost-extractor.ts` for why.
|
|
66
|
+
*
|
|
67
|
+
* `productExpressIds`/`productGlobalIds` use an empty array as a genuine
|
|
68
|
+
* "no products assigned" state, distinct from "not resolved".
|
|
69
|
+
*/
|
|
70
|
+
export interface CostItemInfo {
|
|
71
|
+
expressId: number;
|
|
72
|
+
globalId: string;
|
|
73
|
+
name: string;
|
|
74
|
+
predefinedType?: string;
|
|
75
|
+
costQuantities?: CollectedQuantity[];
|
|
76
|
+
costValues?: CostValueInfo[];
|
|
77
|
+
/** Parent cost item globalId (from IfcRelNests where this item is in RelatedObjects). */
|
|
78
|
+
parentGlobalId?: string;
|
|
79
|
+
/** Child cost item globalIds (from IfcRelNests where this item is RelatingObject). */
|
|
80
|
+
childGlobalIds: string[];
|
|
81
|
+
/** expressIds of objects/products this cost item is assigned to via IfcRelAssignsToControl. */
|
|
82
|
+
productExpressIds: number[];
|
|
83
|
+
/** globalIds of the same products (index-aligned with productExpressIds). */
|
|
84
|
+
productGlobalIds: string[];
|
|
85
|
+
/** CostSchedule globalIds that control this cost item via IfcRelAssignsToControl. */
|
|
86
|
+
controllingScheduleGlobalIds: string[];
|
|
87
|
+
}
|
|
88
|
+
export interface CostScheduleInfo {
|
|
89
|
+
expressId: number;
|
|
90
|
+
globalId: string;
|
|
91
|
+
name: string;
|
|
92
|
+
predefinedType?: string;
|
|
93
|
+
status?: string;
|
|
94
|
+
submittedOn?: string;
|
|
95
|
+
updateDate?: string;
|
|
96
|
+
/** Top-level cost item globalIds directly assigned via IfcRelAssignsToControl. */
|
|
97
|
+
costItemGlobalIds: string[];
|
|
98
|
+
}
|
|
99
|
+
export interface CostExtraction {
|
|
100
|
+
costSchedules: CostScheduleInfo[];
|
|
101
|
+
costItems: CostItemInfo[];
|
|
102
|
+
/** True if we encountered any costing entity (useful for empty-state UI). */
|
|
103
|
+
hasCost: boolean;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=cost-types.d.ts.map
|
|
@@ -0,0 +1 @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,CAAC;IACzB,+FAA+F;IAC/F,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,6EAA6E;IAC7E,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,qFAAqF;IACrF,4BAA4B,EAAE,MAAM,EAAE,CAAC;CACxC;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kFAAkF;IAClF,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,gBAAgB,EAAE,CAAC;IAClC,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,6EAA6E;IAC7E,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost-types.js","sourceRoot":"","sources":["../src/cost-types.ts"],"names":[],"mappings":"AAAA;;+DAE+D"}
|
|
@@ -29,6 +29,7 @@ export interface SpatialHierarchyColumns {
|
|
|
29
29
|
storeyHeights: Array<[number, number]>;
|
|
30
30
|
elementToStorey: Array<[number, number]>;
|
|
31
31
|
elementToContainer?: Array<[number, number]>;
|
|
32
|
+
ambiguousStorey?: number[];
|
|
32
33
|
}
|
|
33
34
|
export declare function spatialHierarchyToColumns(hierarchy: SpatialHierarchy): SpatialHierarchyColumns;
|
|
34
35
|
export declare function spatialHierarchyFromColumns(columns: SpatialHierarchyColumns): SpatialHierarchy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-store-transport.d.ts","sourceRoot":"","sources":["../src/data-store-transport.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,OAAO,E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