@ifc-lite/parser 5.2.0 → 6.2.1
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/georef-extractor.js +5 -5
- package/dist/georef-extractor.js.map +1 -1
- 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 +7 -1
- package/dist/ifczip.d.ts.map +1 -1
- package/dist/ifczip.js +80 -14
- 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 +11 -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 +106 -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 +64 -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 +133 -0
- package/dist/step-record-boundary.js.map +1 -0
- package/dist/step-record-boundary.vectors.d.ts +102 -0
- package/dist/step-record-boundary.vectors.d.ts.map +1 -0
- package/dist/step-record-boundary.vectors.js +131 -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 +78 -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,221 @@
|
|
|
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 { parseIso8601Duration } from './iso8601-duration.js';
|
|
5
|
+
/** IFC4 STEP attribute indices for IfcTask. */
|
|
6
|
+
export const TASK_ATTR = {
|
|
7
|
+
GlobalId: 0,
|
|
8
|
+
Name: 2,
|
|
9
|
+
Description: 3,
|
|
10
|
+
ObjectType: 4,
|
|
11
|
+
Identification: 5,
|
|
12
|
+
LongDescription: 6,
|
|
13
|
+
Status: 7,
|
|
14
|
+
WorkMethod: 8,
|
|
15
|
+
IsMilestone: 9,
|
|
16
|
+
Priority: 10,
|
|
17
|
+
TaskTime: 11,
|
|
18
|
+
PredefinedType: 12,
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* IFC2X3 IfcTask layout — the attributes IfcTask itself adds over IfcObject
|
|
22
|
+
* (TaskId, Status, WorkMethod, IsMilestone, Priority). IFC2X3 schedule times
|
|
23
|
+
* live on `IfcScheduleTimeControl` and link to IfcTask via `IfcRelAssignsTasks`
|
|
24
|
+
* — we don't resolve those here yet; best-effort 2x3 models only surface task
|
|
25
|
+
* metadata without dates.
|
|
26
|
+
*/
|
|
27
|
+
export const TASK_ATTR_2X3 = {
|
|
28
|
+
GlobalId: 0,
|
|
29
|
+
Name: 2,
|
|
30
|
+
Description: 3,
|
|
31
|
+
ObjectType: 4,
|
|
32
|
+
TaskId: 5,
|
|
33
|
+
Status: 6,
|
|
34
|
+
WorkMethod: 7,
|
|
35
|
+
IsMilestone: 8,
|
|
36
|
+
Priority: 9,
|
|
37
|
+
};
|
|
38
|
+
const TASK_TIME_ATTR = {
|
|
39
|
+
Name: 0,
|
|
40
|
+
DurationType: 3,
|
|
41
|
+
ScheduleDuration: 4,
|
|
42
|
+
ScheduleStart: 5,
|
|
43
|
+
ScheduleFinish: 6,
|
|
44
|
+
EarlyStart: 7,
|
|
45
|
+
EarlyFinish: 8,
|
|
46
|
+
LateStart: 9,
|
|
47
|
+
LateFinish: 10,
|
|
48
|
+
FreeFloat: 11,
|
|
49
|
+
TotalFloat: 12,
|
|
50
|
+
IsCritical: 13,
|
|
51
|
+
StatusTime: 14,
|
|
52
|
+
ActualDuration: 15,
|
|
53
|
+
ActualStart: 16,
|
|
54
|
+
ActualFinish: 17,
|
|
55
|
+
RemainingTime: 18,
|
|
56
|
+
Completion: 19,
|
|
57
|
+
};
|
|
58
|
+
export const REL_SEQUENCE_ATTR = {
|
|
59
|
+
GlobalId: 0,
|
|
60
|
+
RelatingProcess: 4,
|
|
61
|
+
RelatedProcess: 5,
|
|
62
|
+
TimeLag: 6,
|
|
63
|
+
SequenceType: 7,
|
|
64
|
+
UserDefinedSequenceType: 8,
|
|
65
|
+
};
|
|
66
|
+
export const REL_ASSIGNS_TO_PROCESS_ATTR = {
|
|
67
|
+
RelatedObjects: 4,
|
|
68
|
+
RelatingProcess: 6,
|
|
69
|
+
};
|
|
70
|
+
export const REL_ASSIGNS_TO_CONTROL_ATTR = {
|
|
71
|
+
RelatedObjects: 4,
|
|
72
|
+
RelatingControl: 6,
|
|
73
|
+
};
|
|
74
|
+
export const REL_NESTS_ATTR = {
|
|
75
|
+
RelatingObject: 4,
|
|
76
|
+
RelatedObjects: 5,
|
|
77
|
+
};
|
|
78
|
+
export const WORK_SCHEDULE_ATTR = {
|
|
79
|
+
GlobalId: 0,
|
|
80
|
+
Name: 2,
|
|
81
|
+
Description: 3,
|
|
82
|
+
ObjectType: 4,
|
|
83
|
+
Identification: 5,
|
|
84
|
+
CreationDate: 6,
|
|
85
|
+
Purpose: 8,
|
|
86
|
+
Duration: 9,
|
|
87
|
+
TotalFloat: 10,
|
|
88
|
+
StartTime: 11,
|
|
89
|
+
FinishTime: 12,
|
|
90
|
+
PredefinedType: 13,
|
|
91
|
+
};
|
|
92
|
+
export const WORK_PLAN_ATTR = WORK_SCHEDULE_ATTR;
|
|
93
|
+
const LAG_TIME_ATTR = {
|
|
94
|
+
LagValue: 3,
|
|
95
|
+
DurationType: 4,
|
|
96
|
+
};
|
|
97
|
+
export function asString(v) {
|
|
98
|
+
if (typeof v === 'string' && v.length > 0)
|
|
99
|
+
return v;
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
export function asNumber(v) {
|
|
103
|
+
if (typeof v === 'number' && Number.isFinite(v))
|
|
104
|
+
return v;
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
export function asBoolean(v) {
|
|
108
|
+
if (typeof v === 'boolean')
|
|
109
|
+
return v;
|
|
110
|
+
// STEP booleans are typically stored as '.T.' / '.F.' after parsing
|
|
111
|
+
if (typeof v === 'string') {
|
|
112
|
+
if (v === '.T.' || v === 'T')
|
|
113
|
+
return true;
|
|
114
|
+
if (v === '.F.' || v === 'F')
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
return undefined;
|
|
118
|
+
}
|
|
119
|
+
export function asEnum(v) {
|
|
120
|
+
if (typeof v !== 'string' || v.length === 0)
|
|
121
|
+
return undefined;
|
|
122
|
+
// STEP enum looks like .PLANNED.
|
|
123
|
+
const match = v.match(/^\.([A-Z_]+)\.$/);
|
|
124
|
+
return match ? match[1] : undefined;
|
|
125
|
+
}
|
|
126
|
+
export function asRef(v) {
|
|
127
|
+
if (typeof v === 'number' && Number.isInteger(v) && v > 0)
|
|
128
|
+
return v;
|
|
129
|
+
return undefined;
|
|
130
|
+
}
|
|
131
|
+
export function asRefList(v) {
|
|
132
|
+
if (!Array.isArray(v))
|
|
133
|
+
return [];
|
|
134
|
+
const out = [];
|
|
135
|
+
for (const x of v) {
|
|
136
|
+
const id = asRef(x);
|
|
137
|
+
if (id !== undefined)
|
|
138
|
+
out.push(id);
|
|
139
|
+
}
|
|
140
|
+
return out;
|
|
141
|
+
}
|
|
142
|
+
export function sequenceTypeFromString(s) {
|
|
143
|
+
switch (s) {
|
|
144
|
+
case 'START_START':
|
|
145
|
+
case 'START_FINISH':
|
|
146
|
+
case 'FINISH_START':
|
|
147
|
+
case 'FINISH_FINISH':
|
|
148
|
+
case 'USERDEFINED':
|
|
149
|
+
case 'NOTDEFINED':
|
|
150
|
+
return s;
|
|
151
|
+
default:
|
|
152
|
+
return 'FINISH_START';
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function durationTypeFromString(s) {
|
|
156
|
+
switch (s) {
|
|
157
|
+
case 'WORKTIME':
|
|
158
|
+
case 'ELAPSEDTIME':
|
|
159
|
+
case 'NOTDEFINED':
|
|
160
|
+
return s;
|
|
161
|
+
default:
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export function extractTaskTime(extractor, store, taskTimeId) {
|
|
166
|
+
const ref = store.entityIndex.byId.get(taskTimeId);
|
|
167
|
+
if (!ref)
|
|
168
|
+
return undefined;
|
|
169
|
+
const entity = extractor.extractEntity(ref);
|
|
170
|
+
if (!entity)
|
|
171
|
+
return undefined;
|
|
172
|
+
const t = entity.type.toUpperCase();
|
|
173
|
+
if (t !== 'IFCTASKTIME' && t !== 'IFCTASKTIMERECURRING')
|
|
174
|
+
return undefined;
|
|
175
|
+
const a = entity.attributes || [];
|
|
176
|
+
return {
|
|
177
|
+
durationType: durationTypeFromString(asEnum(a[TASK_TIME_ATTR.DurationType])),
|
|
178
|
+
scheduleDuration: asString(a[TASK_TIME_ATTR.ScheduleDuration]),
|
|
179
|
+
scheduleStart: asString(a[TASK_TIME_ATTR.ScheduleStart]),
|
|
180
|
+
scheduleFinish: asString(a[TASK_TIME_ATTR.ScheduleFinish]),
|
|
181
|
+
earlyStart: asString(a[TASK_TIME_ATTR.EarlyStart]),
|
|
182
|
+
earlyFinish: asString(a[TASK_TIME_ATTR.EarlyFinish]),
|
|
183
|
+
lateStart: asString(a[TASK_TIME_ATTR.LateStart]),
|
|
184
|
+
lateFinish: asString(a[TASK_TIME_ATTR.LateFinish]),
|
|
185
|
+
freeFloat: asString(a[TASK_TIME_ATTR.FreeFloat]),
|
|
186
|
+
totalFloat: asString(a[TASK_TIME_ATTR.TotalFloat]),
|
|
187
|
+
isCritical: asBoolean(a[TASK_TIME_ATTR.IsCritical]),
|
|
188
|
+
statusTime: asString(a[TASK_TIME_ATTR.StatusTime]),
|
|
189
|
+
actualDuration: asString(a[TASK_TIME_ATTR.ActualDuration]),
|
|
190
|
+
actualStart: asString(a[TASK_TIME_ATTR.ActualStart]),
|
|
191
|
+
actualFinish: asString(a[TASK_TIME_ATTR.ActualFinish]),
|
|
192
|
+
remainingTime: asString(a[TASK_TIME_ATTR.RemainingTime]),
|
|
193
|
+
completion: asNumber(a[TASK_TIME_ATTR.Completion]),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
export function extractLagTimeSeconds(extractor, store, lagId) {
|
|
197
|
+
const ref = store.entityIndex.byId.get(lagId);
|
|
198
|
+
if (!ref)
|
|
199
|
+
return {};
|
|
200
|
+
const entity = extractor.extractEntity(ref);
|
|
201
|
+
if (!entity)
|
|
202
|
+
return {};
|
|
203
|
+
if (entity.type.toUpperCase() !== 'IFCLAGTIME')
|
|
204
|
+
return {};
|
|
205
|
+
const a = entity.attributes || [];
|
|
206
|
+
const lagValue = a[LAG_TIME_ATTR.LagValue];
|
|
207
|
+
// lagValue is an IfcTimeOrRatioSelect — either a typed wrapper like
|
|
208
|
+
// ['IFCDURATION', 'P1D'] or a direct ratio number.
|
|
209
|
+
if (Array.isArray(lagValue) && lagValue.length === 2) {
|
|
210
|
+
const typeName = String(lagValue[0]).toUpperCase();
|
|
211
|
+
const inner = lagValue[1];
|
|
212
|
+
if (typeName === 'IFCDURATION' && typeof inner === 'string') {
|
|
213
|
+
return { seconds: parseIso8601Duration(inner), duration: inner };
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else if (typeof lagValue === 'string') {
|
|
217
|
+
return { seconds: parseIso8601Duration(lagValue), duration: lagValue };
|
|
218
|
+
}
|
|
219
|
+
return {};
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=schedule-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schedule-types.js","sourceRoot":"","sources":["../src/schedule-types.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAqB/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,+CAA+C;AAC/C,MAAM,CAAC,MAA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S,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAC5C,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,YAAY;QAAE,OAAO,EAAE,CAAC;IAC1D,MAAM,CAAC,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC3C,oEAAoE;IACpE,mDAAmD;IACnD,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACnD,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,QAAQ,KAAK,aAAa,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5D,OAAO,EAAE,OAAO,EAAE,oBAAoB,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QACnE,CAAC;IACH,CAAC;SAAM,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,EAAE,OAAO,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACzE,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects elements whose direct storey containment is ambiguous in the
|
|
3
|
+
* SOURCE FILE itself, i.e. more than one `IfcRelContainedInSpatialStructure`
|
|
4
|
+
* edge names a *different* storey-like spatial structure as the RelatingStructure
|
|
5
|
+
* for the same element (#4311).
|
|
6
|
+
*
|
|
7
|
+
* `elementToStorey` resolves each of these to a single winner, but this
|
|
8
|
+
* module deliberately treats HOW that winner is picked as an implementation
|
|
9
|
+
* detail it does not depend on or describe: as shipped on this branch
|
|
10
|
+
* (pre-#4310), spatial-hierarchy-builder.ts's direct-containment loop
|
|
11
|
+
* assigns `elementToStorey` unconditionally on every storey it visits, so
|
|
12
|
+
* the last storey reached in the aggregation-driven tree walk wins, NOT the
|
|
13
|
+
* first-declared `IfcRelContainedInSpatialStructure` edge - the tie-break is
|
|
14
|
+
* aggregation-order dependent, not declaration-order dependent. #4310
|
|
15
|
+
* changes that to first-declared-wins. Either way, this module answers the
|
|
16
|
+
* question that resolution silently discards - was there more than one
|
|
17
|
+
* candidate at all. The input is `byStorey`, the per-storey list of
|
|
18
|
+
* DIRECTLY contained elements that `SpatialHierarchyBuilder.assemble()`
|
|
19
|
+
* already produces regardless of tie-break strategy, so this stays correct
|
|
20
|
+
* across past and future changes to the resolution logic without needing to
|
|
21
|
+
* change with it.
|
|
22
|
+
*
|
|
23
|
+
* Two edges that repeat the SAME (storey, element) pair are not ambiguous -
|
|
24
|
+
* `RelationshipGraphBuilder` dedupes same-source/target/type `IfcRel*`
|
|
25
|
+
* instances into one edge before either side of this ever sees them
|
|
26
|
+
* (`relationship-graph.ts`), so a genuine duplicate declaration of the exact
|
|
27
|
+
* same fact never reaches `byStorey` twice for the same storey. Only a
|
|
28
|
+
* SECOND, DIFFERENT storey claiming the element counts.
|
|
29
|
+
*/
|
|
30
|
+
/** elementId -> storeyId, DIRECT storey containment only (one entry per
|
|
31
|
+
* storey; see `SpatialHierarchy.byStorey`). */
|
|
32
|
+
export type ByStorey = ReadonlyMap<number, readonly number[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the set of element ids that appear under more than one distinct
|
|
35
|
+
* storey in `byStorey`. O(total direct storey-element pairs); no extra graph
|
|
36
|
+
* traversal beyond what `byStorey` already required to build.
|
|
37
|
+
*/
|
|
38
|
+
export declare function computeAmbiguousStorey(byStorey: ByStorey): Set<number>;
|
|
39
|
+
//# sourceMappingURL=spatial-hierarchy-ambiguity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatial-hierarchy-ambiguity.d.ts","sourceRoot":"","sources":["../src/spatial-hierarchy-ambiguity.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;gDACgD;AAChD,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;AAE9D;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,CActE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
* Returns the set of element ids that appear under more than one distinct
|
|
6
|
+
* storey in `byStorey`. O(total direct storey-element pairs); no extra graph
|
|
7
|
+
* traversal beyond what `byStorey` already required to build.
|
|
8
|
+
*/
|
|
9
|
+
export function computeAmbiguousStorey(byStorey) {
|
|
10
|
+
const firstStorey = new Map();
|
|
11
|
+
const ambiguous = new Set();
|
|
12
|
+
for (const [storeyId, elementIds] of byStorey) {
|
|
13
|
+
for (const elementId of elementIds) {
|
|
14
|
+
const seen = firstStorey.get(elementId);
|
|
15
|
+
if (seen === undefined) {
|
|
16
|
+
firstStorey.set(elementId, storeyId);
|
|
17
|
+
}
|
|
18
|
+
else if (seen !== storeyId) {
|
|
19
|
+
ambiguous.add(elementId);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return ambiguous;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=spatial-hierarchy-ambiguity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatial-hierarchy-ambiguity.js","sourceRoot":"","sources":["../src/spatial-hierarchy-ambiguity.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAoC/D;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAkB;IACvD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC9C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IACpC,KAAK,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC9C,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACxC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACvB,WAAW,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YACvC,CAAC;iBAAM,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { EntityRef } from './types.js';
|
|
2
|
+
import { EntityExtractor } from './entity-extractor.js';
|
|
3
|
+
import type { IfcSourceBytes } from './source-bytes.js';
|
|
4
|
+
/** Source bytes needed to read on-demand attributes off the raw records
|
|
5
|
+
* (storey elevation, LongName). Present on the fresh-parse / cache-with-source
|
|
6
|
+
* path, absent on the source-less `buildFromCache` fallback. */
|
|
7
|
+
export interface AttributeSource {
|
|
8
|
+
source: Uint8Array | IfcSourceBytes;
|
|
9
|
+
entityIndex: {
|
|
10
|
+
byId: {
|
|
11
|
+
get(expressId: number): EntityRef | undefined;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
lengthUnitScale: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Read an entity's LongName by schema attribute *name*. IfcSite / IfcBuilding /
|
|
18
|
+
* IfcBuildingStorey / IfcSpace (and the IFC4.3 facility/infra containers)
|
|
19
|
+
* declare LongName at index 7, but IfcProject carries it at a different slot,
|
|
20
|
+
* so resolving by name (not a fixed index) stays correct across the IfcRoot
|
|
21
|
+
* family. The lookup spans every bundled schema, so IFC4.3 leaves outside the
|
|
22
|
+
* parser's IFC4 codegen pin resolve too. Returns the trimmed value, or
|
|
23
|
+
* undefined when the type declares no LongName, it is empty, or no source
|
|
24
|
+
* buffer is available (the buildFromCache path).
|
|
25
|
+
*/
|
|
26
|
+
export declare function extractLongName(expressId: number, attrSource: AttributeSource | undefined, attrExtractor: EntityExtractor | undefined): string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Extract elevation from an IfcBuildingStorey. Elevation is attribute index 9
|
|
29
|
+
* in both IFC2x3 and IFC4 (GlobalId, OwnerHistory, Name, Description,
|
|
30
|
+
* ObjectType, ObjectPlacement, Representation, LongName, CompositionType,
|
|
31
|
+
* Elevation).
|
|
32
|
+
*/
|
|
33
|
+
export declare function extractElevation(expressId: number, source: Uint8Array | IfcSourceBytes, entityIndex: {
|
|
34
|
+
byId: {
|
|
35
|
+
get(expressId: number): EntityRef | undefined;
|
|
36
|
+
};
|
|
37
|
+
}): number | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Resolve a storey's elevation from its ObjectPlacement, used as a fallback when
|
|
40
|
+
* the Elevation attribute is null. Walks
|
|
41
|
+
* IfcBuildingStorey.ObjectPlacement (IfcLocalPlacement)
|
|
42
|
+
* -> RelativePlacement (IfcAxis2Placement3D)
|
|
43
|
+
* -> Location (IfcCartesianPoint).Coordinates[2]
|
|
44
|
+
* i.e. the storey's Z relative to its parent spatial container, which matches
|
|
45
|
+
* the semantics of the Elevation attribute and avoids folding in any site-level
|
|
46
|
+
* georeferencing Z. Returns the raw (unscaled) Z, or undefined when the chain
|
|
47
|
+
* can't be resolved.
|
|
48
|
+
*/
|
|
49
|
+
export declare function extractPlacementElevation(expressId: number, source: Uint8Array | IfcSourceBytes, entityIndex: {
|
|
50
|
+
byId: {
|
|
51
|
+
get(expressId: number): EntityRef | undefined;
|
|
52
|
+
};
|
|
53
|
+
}): number | undefined;
|
|
54
|
+
//# sourceMappingURL=spatial-hierarchy-attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatial-hierarchy-attributes.d.ts","sourceRoot":"","sources":["../src/spatial-hierarchy-attributes.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKxD;;iEAEiE;AACjE,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,UAAU,GAAG,cAAc,CAAC;IACpC,WAAW,EAAE;QAAE,IAAI,EAAE;YAAE,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;SAAE,CAAA;KAAE,CAAC;IACzE,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,eAAe,GAAG,SAAS,EACvC,aAAa,EAAE,eAAe,GAAG,SAAS,GACzC,MAAM,GAAG,SAAS,CAmBpB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,UAAU,GAAG,cAAc,EACnC,WAAW,EAAE;IAAE,IAAI,EAAE;QAAE,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;KAAE,CAAA;CAAE,GACvE,MAAM,GAAG,SAAS,CAqCpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,UAAU,GAAG,cAAc,EACnC,WAAW,EAAE;IAAE,IAAI,EAAE;QAAE,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;KAAE,CAAA;CAAE,GACvE,MAAM,GAAG,SAAS,CAoCpB"}
|
|
@@ -0,0 +1,145 @@
|
|
|
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
|
+
* Attribute extraction for spatial hierarchy nodes - reads a node's LongName,
|
|
6
|
+
* its IfcBuildingStorey Elevation, and the ObjectPlacement-Z fallback
|
|
7
|
+
* straight off the raw IFC records via `EntityExtractor`.
|
|
8
|
+
*
|
|
9
|
+
* Split out of spatial-hierarchy-builder.ts: these three functions share one
|
|
10
|
+
* concern - resolving values from source bytes when a source is available -
|
|
11
|
+
* distinct from the tree-building recursion in `buildNode` that calls them.
|
|
12
|
+
* Same pattern as spatial-hierarchy-canonical-parent.ts, which split out the
|
|
13
|
+
* cycle-safe canonical-parent resolution for the same reason.
|
|
14
|
+
*/
|
|
15
|
+
import { createLogger, IFC_BUILDING_STOREY_ELEVATION_INDEX, IFC_BUILDING_STOREY_PLACEMENT_INDEX, } from '@ifc-lite/data';
|
|
16
|
+
import { EntityExtractor } from './entity-extractor.js';
|
|
17
|
+
import { getAttributeNamesAcrossSchemas } from './ifc-schema.js';
|
|
18
|
+
const log = createLogger('SpatialHierarchy');
|
|
19
|
+
/**
|
|
20
|
+
* Read an entity's LongName by schema attribute *name*. IfcSite / IfcBuilding /
|
|
21
|
+
* IfcBuildingStorey / IfcSpace (and the IFC4.3 facility/infra containers)
|
|
22
|
+
* declare LongName at index 7, but IfcProject carries it at a different slot,
|
|
23
|
+
* so resolving by name (not a fixed index) stays correct across the IfcRoot
|
|
24
|
+
* family. The lookup spans every bundled schema, so IFC4.3 leaves outside the
|
|
25
|
+
* parser's IFC4 codegen pin resolve too. Returns the trimmed value, or
|
|
26
|
+
* undefined when the type declares no LongName, it is empty, or no source
|
|
27
|
+
* buffer is available (the buildFromCache path).
|
|
28
|
+
*/
|
|
29
|
+
export function extractLongName(expressId, attrSource, attrExtractor) {
|
|
30
|
+
if (!attrSource || !attrExtractor)
|
|
31
|
+
return undefined;
|
|
32
|
+
const ref = attrSource.entityIndex.byId.get(expressId);
|
|
33
|
+
if (!ref)
|
|
34
|
+
return undefined;
|
|
35
|
+
try {
|
|
36
|
+
const entity = attrExtractor.extractEntity(ref);
|
|
37
|
+
if (!entity)
|
|
38
|
+
return undefined;
|
|
39
|
+
const idx = getAttributeNamesAcrossSchemas(entity.type).indexOf('LongName');
|
|
40
|
+
if (idx < 0)
|
|
41
|
+
return undefined;
|
|
42
|
+
const raw = (entity.attributes || [])[idx];
|
|
43
|
+
const value = typeof raw === 'string' ? raw.trim() : '';
|
|
44
|
+
return value.length > 0 ? value : undefined;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
log.caught('Failed to extract LongName', error, {
|
|
48
|
+
operation: 'extractLongName',
|
|
49
|
+
entityId: expressId,
|
|
50
|
+
});
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Extract elevation from an IfcBuildingStorey. Elevation is attribute index 9
|
|
56
|
+
* in both IFC2x3 and IFC4 (GlobalId, OwnerHistory, Name, Description,
|
|
57
|
+
* ObjectType, ObjectPlacement, Representation, LongName, CompositionType,
|
|
58
|
+
* Elevation).
|
|
59
|
+
*/
|
|
60
|
+
export function extractElevation(expressId, source, entityIndex) {
|
|
61
|
+
const ref = entityIndex.byId.get(expressId);
|
|
62
|
+
if (!ref)
|
|
63
|
+
return undefined;
|
|
64
|
+
try {
|
|
65
|
+
const extractor = new EntityExtractor(source);
|
|
66
|
+
const entity = extractor.extractEntity(ref);
|
|
67
|
+
if (!entity)
|
|
68
|
+
return undefined;
|
|
69
|
+
const attrs = entity.attributes || [];
|
|
70
|
+
// Number from a raw value or a typed value like ['IFCLENGTHMEASURE', 3.0].
|
|
71
|
+
const extractNumber = (val) => {
|
|
72
|
+
if (typeof val === 'number')
|
|
73
|
+
return val;
|
|
74
|
+
if (Array.isArray(val) && val.length === 2 && typeof val[1] === 'number') {
|
|
75
|
+
return val[1];
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
};
|
|
79
|
+
// Read ONLY the Elevation slot: a previous "scan every attribute for a
|
|
80
|
+
// number < 10000" fallback wrongly treated reference attributes (parsed as
|
|
81
|
+
// bare express-id numbers, e.g. OwnerHistory #3628 -> 3628) as elevations,
|
|
82
|
+
// so a storey with a null Elevation got a garbage value instead of falling
|
|
83
|
+
// through to the ObjectPlacement-Z fallback below (#1289).
|
|
84
|
+
if (attrs.length > IFC_BUILDING_STOREY_ELEVATION_INDEX) {
|
|
85
|
+
return extractNumber(attrs[IFC_BUILDING_STOREY_ELEVATION_INDEX]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
log.caught('Failed to extract elevation', error, {
|
|
90
|
+
operation: 'extractElevation',
|
|
91
|
+
entityId: expressId,
|
|
92
|
+
entityType: 'IfcBuildingStorey',
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Resolve a storey's elevation from its ObjectPlacement, used as a fallback when
|
|
99
|
+
* the Elevation attribute is null. Walks
|
|
100
|
+
* IfcBuildingStorey.ObjectPlacement (IfcLocalPlacement)
|
|
101
|
+
* -> RelativePlacement (IfcAxis2Placement3D)
|
|
102
|
+
* -> Location (IfcCartesianPoint).Coordinates[2]
|
|
103
|
+
* i.e. the storey's Z relative to its parent spatial container, which matches
|
|
104
|
+
* the semantics of the Elevation attribute and avoids folding in any site-level
|
|
105
|
+
* georeferencing Z. Returns the raw (unscaled) Z, or undefined when the chain
|
|
106
|
+
* can't be resolved.
|
|
107
|
+
*/
|
|
108
|
+
export function extractPlacementElevation(expressId, source, entityIndex) {
|
|
109
|
+
try {
|
|
110
|
+
const extractor = new EntityExtractor(source);
|
|
111
|
+
const readAttrs = (id) => {
|
|
112
|
+
const ref = entityIndex.byId.get(id);
|
|
113
|
+
if (!ref)
|
|
114
|
+
return undefined;
|
|
115
|
+
return extractor.extractEntity(ref)?.attributes ?? undefined;
|
|
116
|
+
};
|
|
117
|
+
const placementId = readAttrs(expressId)?.[IFC_BUILDING_STOREY_PLACEMENT_INDEX];
|
|
118
|
+
if (typeof placementId !== 'number')
|
|
119
|
+
return undefined;
|
|
120
|
+
// IfcLocalPlacement(PlacementRelTo, RelativePlacement) - RelativePlacement
|
|
121
|
+
// (index 1) is the IfcAxis2Placement3D carrying this storey's own offset.
|
|
122
|
+
const axisId = readAttrs(placementId)?.[1];
|
|
123
|
+
if (typeof axisId !== 'number')
|
|
124
|
+
return undefined;
|
|
125
|
+
// IfcAxis2Placement3D(Location, Axis, RefDirection) - Location (index 0) is
|
|
126
|
+
// an IfcCartesianPoint.
|
|
127
|
+
const locationId = readAttrs(axisId)?.[0];
|
|
128
|
+
if (typeof locationId !== 'number')
|
|
129
|
+
return undefined;
|
|
130
|
+
// IfcCartesianPoint.Coordinates (index 0) is a list [x, y, z].
|
|
131
|
+
const coords = readAttrs(locationId)?.[0];
|
|
132
|
+
if (Array.isArray(coords) && coords.length >= 3 && typeof coords[2] === 'number') {
|
|
133
|
+
return coords[2];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
log.caught('Failed to extract placement elevation', error, {
|
|
138
|
+
operation: 'extractPlacementElevation',
|
|
139
|
+
entityId: expressId,
|
|
140
|
+
entityType: 'IfcBuildingStorey',
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
//# sourceMappingURL=spatial-hierarchy-attributes.js.map
|
|
@@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AAO,SAAS,CAAC;QAErD,+DAA+D;QAC/D,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;YACjF,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,uCAAuC,EAAE,KAAK,EAAE;YACzD,SAAS,EAAE,2BAA2B;YACtC,QAAQ,EAAE,SAAS;YACnB,UAAU,EAAE,mBAAmB;SAChC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -30,35 +30,5 @@ export declare class SpatialHierarchyBuilder {
|
|
|
30
30
|
buildFromCache(entities: EntityTable, relationships: RelationshipGraph): SpatialHierarchy | undefined;
|
|
31
31
|
private assemble;
|
|
32
32
|
private buildNode;
|
|
33
|
-
/**
|
|
34
|
-
* Read an entity's LongName by schema attribute *name*. IfcSite / IfcBuilding /
|
|
35
|
-
* IfcBuildingStorey / IfcSpace (and the IFC4.3 facility/infra containers)
|
|
36
|
-
* declare LongName at index 7, but IfcProject carries it at a different slot,
|
|
37
|
-
* so resolving by name (not a fixed index) stays correct across the IfcRoot
|
|
38
|
-
* family. The lookup spans every bundled schema, so IFC4.3 leaves outside the
|
|
39
|
-
* parser's IFC4 codegen pin resolve too. Returns the trimmed value, or
|
|
40
|
-
* undefined when the type declares no LongName, it is empty, or no source
|
|
41
|
-
* buffer is available (the buildFromCache path).
|
|
42
|
-
*/
|
|
43
|
-
private extractLongName;
|
|
44
|
-
/**
|
|
45
|
-
* Extract elevation from an IfcBuildingStorey. Elevation is attribute index 9
|
|
46
|
-
* in both IFC2x3 and IFC4 (GlobalId, OwnerHistory, Name, Description,
|
|
47
|
-
* ObjectType, ObjectPlacement, Representation, LongName, CompositionType,
|
|
48
|
-
* Elevation).
|
|
49
|
-
*/
|
|
50
|
-
private extractElevation;
|
|
51
|
-
/**
|
|
52
|
-
* Resolve a storey's elevation from its ObjectPlacement, used as a fallback when
|
|
53
|
-
* the Elevation attribute is null. Walks
|
|
54
|
-
* IfcBuildingStorey.ObjectPlacement (IfcLocalPlacement)
|
|
55
|
-
* -> RelativePlacement (IfcAxis2Placement3D)
|
|
56
|
-
* -> Location (IfcCartesianPoint).Coordinates[2]
|
|
57
|
-
* i.e. the storey's Z relative to its parent spatial container, which matches
|
|
58
|
-
* the semantics of the Elevation attribute and avoids folding in any site-level
|
|
59
|
-
* georeferencing Z. Returns the raw (unscaled) Z, or undefined when the chain
|
|
60
|
-
* can't be resolved.
|
|
61
|
-
*/
|
|
62
|
-
private extractPlacementElevation;
|
|
63
33
|
}
|
|
64
34
|
//# sourceMappingURL=spatial-hierarchy-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spatial-hierarchy-builder.d.ts","sourceRoot":"","sources":["../src/spatial-hierarchy-builder.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAe,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"spatial-hierarchy-builder.d.ts","sourceRoot":"","sources":["../src/spatial-hierarchy-builder.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAe,MAAM,gBAAgB,CAAC;AAWjH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAiCxD,qBAAa,uBAAuB;IAClC;;;;;OAKG;IACH,KAAK,CACH,QAAQ,EAAE,WAAW,EACrB,aAAa,EAAE,iBAAiB,EAChC,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,UAAU,GAAG,cAAc,EACnC,WAAW,EAAE;QAAE,IAAI,EAAE;YAAE,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;SAAE,CAAA;KAAE,EACxE,eAAe,GAAE,MAAY,GAC5B,gBAAgB;IAMnB;;;OAGG;IACH,cAAc,CACZ,QAAQ,EAAE,WAAW,EACrB,aAAa,EAAE,iBAAiB,GAC/B,gBAAgB,GAAG,SAAS;IAI/B,OAAO,CAAC,QAAQ;IA6EhB,OAAO,CAAC,SAAS;CAwLlB"}
|