@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,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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spatial-hierarchy-attributes.js","sourceRoot":"","sources":["../src/spatial-hierarchy-attributes.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;GAUG;AAEH,OAAO,EACL,YAAY,EACZ,mCAAmC,EACnC,mCAAmC,GACpC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAEjE,MAAM,GAAG,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAC;AAW7C;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,SAAiB,EACjB,UAAuC,EACvC,aAA0C;IAE1C,IAAI,CAAC,UAAU,IAAI,CAAC,aAAa;Q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O,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"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
|
-
import { IfcTypeEnum, RelationshipType,
|
|
4
|
+
import { IfcTypeEnum, RelationshipType, isBuildingLikeSpatialType, isSpaceLikeSpatialType, isSpatialStructureType, isStoreyLikeSpatialType, findStoreyByElevation, spatialLookups, } from '@ifc-lite/data';
|
|
5
5
|
import { EntityExtractor } from './entity-extractor.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import { computeCanonicalParent, computeReachableSpatialNodes } from './spatial-hierarchy-canonical-parent.js';
|
|
7
|
+
import { extractLongName, extractElevation, extractPlacementElevation, } from './spatial-hierarchy-attributes.js';
|
|
8
|
+
import { computeAmbiguousStorey } from './spatial-hierarchy-ambiguity.js';
|
|
9
9
|
export class SpatialHierarchyBuilder {
|
|
10
10
|
/**
|
|
11
11
|
* Fresh-parse build. Extracts storey elevations from the source buffer.
|
|
@@ -38,6 +38,7 @@ export class SpatialHierarchyBuilder {
|
|
|
38
38
|
elementToContainer: new Map(),
|
|
39
39
|
visited: new Set(),
|
|
40
40
|
canonicalParent: computeCanonicalParent(entities, relationships),
|
|
41
|
+
reachableSpatialNodes: new Set(), // filled in below once IfcProject is known
|
|
41
42
|
attrSource,
|
|
42
43
|
attrExtractor: attrSource ? new EntityExtractor(attrSource.source) : undefined,
|
|
43
44
|
};
|
|
@@ -49,6 +50,10 @@ export class SpatialHierarchyBuilder {
|
|
|
49
50
|
}
|
|
50
51
|
return undefined;
|
|
51
52
|
}
|
|
53
|
+
// Which storeys buildNode will actually recurse into, computed up front
|
|
54
|
+
// so ContainsElements resolution below never depends on this node's own
|
|
55
|
+
// position in the traversal (#4310) - see computeReachableSpatialNodes.
|
|
56
|
+
ctx.reachableSpatialNodes = computeReachableSpatialNodes(projectIds[0], ctx.canonicalParent);
|
|
52
57
|
const projectNode = this.buildNode(projectIds[0], ctx);
|
|
53
58
|
if (ctx.byStorey.size === 0) {
|
|
54
59
|
console.warn('[SpatialHierarchyBuilder] No storeys found in spatial hierarchy');
|
|
@@ -57,13 +62,6 @@ export class SpatialHierarchyBuilder {
|
|
|
57
62
|
console.warn('[SpatialHierarchyBuilder] No buildings found in spatial hierarchy');
|
|
58
63
|
}
|
|
59
64
|
const { byStorey, byBuilding, bySite, bySpace, storeyElevations, elementToStorey, elementToContainer } = ctx;
|
|
60
|
-
// Pre-build the element -> space lookup for O(1) getContainingSpace.
|
|
61
|
-
const elementToSpace = new Map();
|
|
62
|
-
for (const [spaceId, elementIds] of bySpace) {
|
|
63
|
-
for (const elementId of elementIds) {
|
|
64
|
-
elementToSpace.set(elementId, spaceId);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
65
|
return {
|
|
68
66
|
project: projectNode,
|
|
69
67
|
byStorey,
|
|
@@ -75,6 +73,7 @@ export class SpatialHierarchyBuilder {
|
|
|
75
73
|
storeyHeights: new Map(),
|
|
76
74
|
elementToStorey,
|
|
77
75
|
elementToContainer,
|
|
76
|
+
ambiguousStorey: computeAmbiguousStorey(byStorey), // #4311
|
|
78
77
|
getStoreyElements(storeyId) {
|
|
79
78
|
return byStorey.get(storeyId) ?? [];
|
|
80
79
|
},
|
|
@@ -84,29 +83,7 @@ export class SpatialHierarchyBuilder {
|
|
|
84
83
|
// Z can never resolve to a different storey depending on entry path.
|
|
85
84
|
return findStoreyByElevation(storeyElevations, z);
|
|
86
85
|
},
|
|
87
|
-
|
|
88
|
-
return elementToSpace.get(elementId) ?? null;
|
|
89
|
-
},
|
|
90
|
-
getPath(elementId) {
|
|
91
|
-
const path = [];
|
|
92
|
-
const findPath = (node, targetId) => {
|
|
93
|
-
path.push(node);
|
|
94
|
-
// Match the node itself (so a promoted space/zone resolves) or one of
|
|
95
|
-
// its contained elements.
|
|
96
|
-
if (node.expressId === targetId || node.elements.includes(targetId)) {
|
|
97
|
-
return true;
|
|
98
|
-
}
|
|
99
|
-
for (const child of node.children) {
|
|
100
|
-
if (findPath(child, targetId)) {
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
path.pop();
|
|
105
|
-
return false;
|
|
106
|
-
};
|
|
107
|
-
findPath(projectNode, elementId);
|
|
108
|
-
return path;
|
|
109
|
-
},
|
|
86
|
+
...spatialLookups(projectNode, bySpace, elementToContainer),
|
|
110
87
|
};
|
|
111
88
|
}
|
|
112
89
|
buildNode(expressId, ctx) {
|
|
@@ -118,17 +95,23 @@ export class SpatialHierarchyBuilder {
|
|
|
118
95
|
// show both (issue #1634). It lives only in the raw record, so it needs the
|
|
119
96
|
// source bytes; the source-less buildFromCache fallback leaves it undefined,
|
|
120
97
|
// exactly like storey elevation.
|
|
121
|
-
const rawLongName =
|
|
98
|
+
const rawLongName = extractLongName(expressId, ctx.attrSource, ctx.attrExtractor);
|
|
122
99
|
// Fall back to LongName when Name is empty (common for IfcSpace). Left
|
|
123
100
|
// empty, not a fabricated `Entity #<id>` — it flows into the export layer.
|
|
124
101
|
const name = rawName || rawLongName || '';
|
|
125
102
|
// Only keep LongName as a distinct descriptor when it adds something beyond
|
|
126
103
|
// the primary label (never duplicate it into the secondary slot).
|
|
127
104
|
const longName = rawLongName && rawLongName !== name ? rawLongName : undefined;
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
//
|
|
105
|
+
// This is NOT what actually prevents unbounded recursion on a cyclic
|
|
106
|
+
// IfcRelAggregates chain (A aggregates B, B aggregates A) - it never
|
|
107
|
+
// fires today. Recursion here only ever follows a node's ONE canonical
|
|
108
|
+
// parent (computeCanonicalParent in spatial-hierarchy-canonical-parent.ts
|
|
109
|
+
// picks exactly one, and skips any candidate that would close a cycle
|
|
110
|
+
// back through the child, #4246), so a cycle can supply at most one
|
|
111
|
+
// recursion edge into any node - which structurally cannot loop. Kept as
|
|
112
|
+
// defence in depth in case that single-parent invariant is ever
|
|
113
|
+
// weakened; if it does fire, a revisited node is returned as a leaf so
|
|
114
|
+
// the rest of the hierarchy still builds.
|
|
132
115
|
if (ctx.visited.has(expressId)) {
|
|
133
116
|
return { expressId, type: typeEnum, name, longName, elevation: undefined, children: [], elements: [] };
|
|
134
117
|
}
|
|
@@ -137,12 +120,12 @@ export class SpatialHierarchyBuilder {
|
|
|
137
120
|
let elevation;
|
|
138
121
|
if (typeEnum === IfcTypeEnum.IfcBuildingStorey && ctx.attrSource) {
|
|
139
122
|
const { source, entityIndex, lengthUnitScale } = ctx.attrSource;
|
|
140
|
-
let rawElevation =
|
|
123
|
+
let rawElevation = extractElevation(expressId, source, entityIndex);
|
|
141
124
|
if (rawElevation === undefined) {
|
|
142
125
|
// Elevation is optional and frequently null (Revit / ArchiCAD). Fall back
|
|
143
126
|
// to the storey's Z from its ObjectPlacement so it still orders + lifts in
|
|
144
127
|
// Exploded mode instead of collapsing to a single floor (#1289).
|
|
145
|
-
rawElevation =
|
|
128
|
+
rawElevation = extractPlacementElevation(expressId, source, entityIndex);
|
|
146
129
|
}
|
|
147
130
|
if (rawElevation !== undefined) {
|
|
148
131
|
elevation = rawElevation * lengthUnitScale;
|
|
@@ -205,6 +188,27 @@ export class SpatialHierarchyBuilder {
|
|
|
205
188
|
}
|
|
206
189
|
if (isStoreyLikeSpatialType(typeEnum)) {
|
|
207
190
|
for (const elementId of containedElements) {
|
|
191
|
+
// First-declared wins on duplicate containment, matching containedIn()
|
|
192
|
+
// (#4248) - but only among storeys buildNode actually visits. A
|
|
193
|
+
// first-declared edge naming an unreachable storey (no path back to
|
|
194
|
+
// IfcProject, e.g. missing its own IfcRelAggregates edge) is not a
|
|
195
|
+
// real competing answer: buildNode never runs that storey's own
|
|
196
|
+
// branch, so nothing would ever claim the element there, and the
|
|
197
|
+
// element must not be dropped just because a later-declared but
|
|
198
|
+
// VIABLE storey lost a tie to a candidate that can't win (#4310).
|
|
199
|
+
// Only storey-like containers compete: a reachable IfcSpace edge
|
|
200
|
+
// declared first is not a storey answer, and letting it win here
|
|
201
|
+
// would leave the element with no elementToStorey entry at all
|
|
202
|
+
// (spaces never run this branch).
|
|
203
|
+
const containerEdges = relationships.inverse.getEdges(elementId, RelationshipType.ContainsElements);
|
|
204
|
+
const firstViableContainer = containerEdges.find((edge) => ctx.reachableSpatialNodes.has(edge.target) && isStoreyLikeSpatialType(entities.getTypeEnum(edge.target)));
|
|
205
|
+
// expressId is always reachable here (buildNode only runs on reachable
|
|
206
|
+
// nodes) and always has an edge to elementId (elementId came from THIS
|
|
207
|
+
// storey's own containedElements), so firstViableContainer is always
|
|
208
|
+
// defined - it can never fall through to the pre-#4310 "assign
|
|
209
|
+
// unconditionally" behavior by surprise.
|
|
210
|
+
if (firstViableContainer && firstViableContainer.target !== expressId)
|
|
211
|
+
continue; // a viable earlier-declared storey wins instead
|
|
208
212
|
ctx.elementToStorey.set(elementId, expressId);
|
|
209
213
|
// Propagate the storey assignment to aggregated descendants (e.g. an
|
|
210
214
|
// IfcBuildingElementPart child of an IfcWall). Without this, parts have no
|
|
@@ -266,131 +270,5 @@ export class SpatialHierarchyBuilder {
|
|
|
266
270
|
}
|
|
267
271
|
return { expressId, type: typeEnum, name, longName, elevation, children: childNodes, elements: containedElements };
|
|
268
272
|
}
|
|
269
|
-
/**
|
|
270
|
-
* Read an entity's LongName by schema attribute *name*. IfcSite / IfcBuilding /
|
|
271
|
-
* IfcBuildingStorey / IfcSpace (and the IFC4.3 facility/infra containers)
|
|
272
|
-
* declare LongName at index 7, but IfcProject carries it at a different slot,
|
|
273
|
-
* so resolving by name (not a fixed index) stays correct across the IfcRoot
|
|
274
|
-
* family. The lookup spans every bundled schema, so IFC4.3 leaves outside the
|
|
275
|
-
* parser's IFC4 codegen pin resolve too. Returns the trimmed value, or
|
|
276
|
-
* undefined when the type declares no LongName, it is empty, or no source
|
|
277
|
-
* buffer is available (the buildFromCache path).
|
|
278
|
-
*/
|
|
279
|
-
extractLongName(expressId, ctx) {
|
|
280
|
-
if (!ctx.attrSource || !ctx.attrExtractor)
|
|
281
|
-
return undefined;
|
|
282
|
-
const ref = ctx.attrSource.entityIndex.byId.get(expressId);
|
|
283
|
-
if (!ref)
|
|
284
|
-
return undefined;
|
|
285
|
-
try {
|
|
286
|
-
const entity = ctx.attrExtractor.extractEntity(ref);
|
|
287
|
-
if (!entity)
|
|
288
|
-
return undefined;
|
|
289
|
-
const idx = getAttributeNamesAcrossSchemas(entity.type).indexOf('LongName');
|
|
290
|
-
if (idx < 0)
|
|
291
|
-
return undefined;
|
|
292
|
-
const raw = (entity.attributes || [])[idx];
|
|
293
|
-
const value = typeof raw === 'string' ? raw.trim() : '';
|
|
294
|
-
return value.length > 0 ? value : undefined;
|
|
295
|
-
}
|
|
296
|
-
catch (error) {
|
|
297
|
-
log.caught('Failed to extract LongName', error, {
|
|
298
|
-
operation: 'extractLongName',
|
|
299
|
-
entityId: expressId,
|
|
300
|
-
});
|
|
301
|
-
return undefined;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Extract elevation from an IfcBuildingStorey. Elevation is attribute index 9
|
|
306
|
-
* in both IFC2x3 and IFC4 (GlobalId, OwnerHistory, Name, Description,
|
|
307
|
-
* ObjectType, ObjectPlacement, Representation, LongName, CompositionType,
|
|
308
|
-
* Elevation).
|
|
309
|
-
*/
|
|
310
|
-
extractElevation(expressId, source, entityIndex) {
|
|
311
|
-
const ref = entityIndex.byId.get(expressId);
|
|
312
|
-
if (!ref)
|
|
313
|
-
return undefined;
|
|
314
|
-
try {
|
|
315
|
-
const extractor = new EntityExtractor(source);
|
|
316
|
-
const entity = extractor.extractEntity(ref);
|
|
317
|
-
if (!entity)
|
|
318
|
-
return undefined;
|
|
319
|
-
const attrs = entity.attributes || [];
|
|
320
|
-
// Number from a raw value or a typed value like ['IFCLENGTHMEASURE', 3.0].
|
|
321
|
-
const extractNumber = (val) => {
|
|
322
|
-
if (typeof val === 'number')
|
|
323
|
-
return val;
|
|
324
|
-
if (Array.isArray(val) && val.length === 2 && typeof val[1] === 'number') {
|
|
325
|
-
return val[1];
|
|
326
|
-
}
|
|
327
|
-
return undefined;
|
|
328
|
-
};
|
|
329
|
-
// Read ONLY the Elevation slot: a previous "scan every attribute for a
|
|
330
|
-
// number < 10000" fallback wrongly treated reference attributes (parsed as
|
|
331
|
-
// bare express-id numbers, e.g. OwnerHistory #3628 -> 3628) as elevations,
|
|
332
|
-
// so a storey with a null Elevation got a garbage value instead of falling
|
|
333
|
-
// through to the ObjectPlacement-Z fallback below (#1289).
|
|
334
|
-
if (attrs.length > IFC_BUILDING_STOREY_ELEVATION_INDEX) {
|
|
335
|
-
return extractNumber(attrs[IFC_BUILDING_STOREY_ELEVATION_INDEX]);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
catch (error) {
|
|
339
|
-
log.caught('Failed to extract elevation', error, {
|
|
340
|
-
operation: 'extractElevation',
|
|
341
|
-
entityId: expressId,
|
|
342
|
-
entityType: 'IfcBuildingStorey',
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
return undefined;
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Resolve a storey's elevation from its ObjectPlacement, used as a fallback when
|
|
349
|
-
* the Elevation attribute is null. Walks
|
|
350
|
-
* IfcBuildingStorey.ObjectPlacement (IfcLocalPlacement)
|
|
351
|
-
* -> RelativePlacement (IfcAxis2Placement3D)
|
|
352
|
-
* -> Location (IfcCartesianPoint).Coordinates[2]
|
|
353
|
-
* i.e. the storey's Z relative to its parent spatial container, which matches
|
|
354
|
-
* the semantics of the Elevation attribute and avoids folding in any site-level
|
|
355
|
-
* georeferencing Z. Returns the raw (unscaled) Z, or undefined when the chain
|
|
356
|
-
* can't be resolved.
|
|
357
|
-
*/
|
|
358
|
-
extractPlacementElevation(expressId, source, entityIndex) {
|
|
359
|
-
try {
|
|
360
|
-
const extractor = new EntityExtractor(source);
|
|
361
|
-
const readAttrs = (id) => {
|
|
362
|
-
const ref = entityIndex.byId.get(id);
|
|
363
|
-
if (!ref)
|
|
364
|
-
return undefined;
|
|
365
|
-
return extractor.extractEntity(ref)?.attributes ?? undefined;
|
|
366
|
-
};
|
|
367
|
-
const placementId = readAttrs(expressId)?.[IFC_BUILDING_STOREY_PLACEMENT_INDEX];
|
|
368
|
-
if (typeof placementId !== 'number')
|
|
369
|
-
return undefined;
|
|
370
|
-
// IfcLocalPlacement(PlacementRelTo, RelativePlacement) - RelativePlacement
|
|
371
|
-
// (index 1) is the IfcAxis2Placement3D carrying this storey's own offset.
|
|
372
|
-
const axisId = readAttrs(placementId)?.[1];
|
|
373
|
-
if (typeof axisId !== 'number')
|
|
374
|
-
return undefined;
|
|
375
|
-
// IfcAxis2Placement3D(Location, Axis, RefDirection) - Location (index 0) is
|
|
376
|
-
// an IfcCartesianPoint.
|
|
377
|
-
const locationId = readAttrs(axisId)?.[0];
|
|
378
|
-
if (typeof locationId !== 'number')
|
|
379
|
-
return undefined;
|
|
380
|
-
// IfcCartesianPoint.Coordinates (index 0) is a list [x, y, z].
|
|
381
|
-
const coords = readAttrs(locationId)?.[0];
|
|
382
|
-
if (Array.isArray(coords) && coords.length >= 3 && typeof coords[2] === 'number') {
|
|
383
|
-
return coords[2];
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
catch (error) {
|
|
387
|
-
log.caught('Failed to extract placement elevation', error, {
|
|
388
|
-
operation: 'extractPlacementElevation',
|
|
389
|
-
entityId: expressId,
|
|
390
|
-
entityType: 'IfcBuildingStorey',
|
|
391
|
-
});
|
|
392
|
-
}
|
|
393
|
-
return undefined;
|
|
394
|
-
}
|
|
395
273
|
}
|
|
396
274
|
//# sourceMappingURL=spatial-hierarchy-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spatial-hierarchy-builder.js","sourceRoot":"","sources":["../src/spatial-hierarchy-builder.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAc/D,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,yBAAyB,E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CAAC,CAAC;gBACjD,MAAM,KAAK,GAAa,CAAC,SAAS,CAAC,CAAC;gBACpC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAS,CAAC,SAAS,CAAC,CAAC,CAAC;gBAC1C,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxB,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,EAAY,CAAC;oBACtC,MAAM,cAAc,GAAG,aAAa,CAAC,UAAU,CAAC,OAAO,EAAE,gBAAgB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;oBACjG,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;wBACjC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;4BAAE,SAAS;wBAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;wBACd,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;4BACrC,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;wBAC7C,CAAC;wBACD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;oBAClB,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IACrH,CAAC;CACF"}
|
|
@@ -3,6 +3,27 @@
|
|
|
3
3
|
* under the module-size budget, #4095).
|
|
4
4
|
*/
|
|
5
5
|
import type { EntityTable, RelationshipGraph } from '@ifc-lite/data';
|
|
6
|
+
/**
|
|
7
|
+
* Is `candidateParent` reachable from `childId` by walking forward
|
|
8
|
+
* `IfcRelAggregates` edges (i.e. is `childId` an ANCESTOR of `candidateParent`
|
|
9
|
+
* in the raw, unresolved aggregation graph)? Used only to disqualify a tied
|
|
10
|
+
* candidate parent that would close a cycle back through the child itself -
|
|
11
|
+
* see the doc comment on `computeCanonicalParent` for why that specific shape
|
|
12
|
+
* needs a check at all. Bounded to `childId`'s own (raw) aggregation
|
|
13
|
+
* subtree, so it only costs anything on an already-malformed file where a
|
|
14
|
+
* child has more than one candidate Aggregates parent - the common case
|
|
15
|
+
* (one candidate) never calls this.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Upper bound on aggregate-graph node visits spent on back-edge cycle checks
|
|
19
|
+
* for one file. The check only runs for children named by MORE THAN ONE
|
|
20
|
+
* IfcRelAggregates (already malformed), and costs one descendant walk per
|
|
21
|
+
* such child - O(V+E) each - so a crafted file with thousands of contested
|
|
22
|
+
* children could otherwise burn O(C·(V+E)). Past the budget the resolver
|
|
23
|
+
* falls back to plain first-declared-wins (the pre-#4285 behaviour) and says
|
|
24
|
+
* so once, instead of stalling the parse.
|
|
25
|
+
*/
|
|
26
|
+
export declare const CYCLE_CHECK_VISIT_BUDGET = 2000000;
|
|
6
27
|
/**
|
|
7
28
|
* Resolve each spatial-structure entity's ONE canonical parent, globally,
|
|
8
29
|
* before any recursion starts - so the result cannot depend on traversal
|
|
@@ -21,7 +42,19 @@ import type { EntityTable, RelationshipGraph } from '@ifc-lite/data';
|
|
|
21
42
|
* sort is stable per key (`relationship-graph.ts`) - it scatters edges
|
|
22
43
|
* for the same child in the order they were appended, never
|
|
23
44
|
* reordering by id. So `edges[0]` for a given child is the
|
|
24
|
-
* first-declared parent edge; no id comparison is needed or correct
|
|
45
|
+
* first-declared parent edge; no id comparison is needed or correct -
|
|
46
|
+
* EXCEPT that a candidate closing a cycle back through the child is
|
|
47
|
+
* skipped first (see `aggregatedDescendants`, #4246): a mutual or
|
|
48
|
+
* longer aggregation back-edge cannot win a tie against a candidate that
|
|
49
|
+
* doesn't orphan the child's own subtree from itself. Each time that
|
|
50
|
+
* happens, a warning is logged (always-visible, like the existing
|
|
51
|
+
* "No storeys/buildings found" warnings below) naming the child and the
|
|
52
|
+
* disqualified candidate - the only signal a caller gets that a
|
|
53
|
+
* malformed back-edge was found and repaired, short of building a
|
|
54
|
+
* dedicated report (out of scope here; see the #4208 semantic drop
|
|
55
|
+
* census for that shape of reporting - a different layer: per-STEP-class
|
|
56
|
+
* scan/retain counts collected during columnar categorization, not a
|
|
57
|
+
* graph-repair event like this one).
|
|
25
58
|
* 2. Only when a child has NO aggregates edge at all does a containment edge
|
|
26
59
|
* (IfcRelContainedInSpatialStructure targeting a spatial-structure type -
|
|
27
60
|
* the Revit Family/Dynamo `IfcSpace`/`IfcSpatialZone` pattern, #1075)
|
|
@@ -32,5 +65,22 @@ import type { EntityTable, RelationshipGraph } from '@ifc-lite/data';
|
|
|
32
65
|
* names the child drops the edge instead of adding an empty-stub duplicate
|
|
33
66
|
* (#4095).
|
|
34
67
|
*/
|
|
35
|
-
export declare function computeCanonicalParent(entities: EntityTable, relationships: RelationshipGraph
|
|
68
|
+
export declare function computeCanonicalParent(entities: EntityTable, relationships: RelationshipGraph, options?: {
|
|
69
|
+
cycleCheckVisitBudget?: number;
|
|
70
|
+
}): Map<number, number>;
|
|
71
|
+
/**
|
|
72
|
+
* Which spatial-structure nodes will `SpatialHierarchyBuilder.buildNode`
|
|
73
|
+
* actually visit, starting from `projectId`? Mirrors `addSpatialChild`
|
|
74
|
+
* exactly: a node is visited iff it is `projectId` itself, or its
|
|
75
|
+
* `canonicalParent` entry points to an already-visited node - the same
|
|
76
|
+
* check `addSpatialChild` makes before recursing (`canonicalParent.get
|
|
77
|
+
* (childId) === expressId`). Computed as one forward walk over
|
|
78
|
+
* `canonicalParent` (childId -> parentId) up front, so a storey's
|
|
79
|
+
* reachability never depends on where in the traversal it happens to sit
|
|
80
|
+
* (#4310): a node named only by an unreachable storey - one with no path
|
|
81
|
+
* back to `projectId`, e.g. a malformed file where a storey has no
|
|
82
|
+
* `IfcRelAggregates` edge at all - is never in this set, exactly as
|
|
83
|
+
* `buildNode` would never recurse into it.
|
|
84
|
+
*/
|
|
85
|
+
export declare function computeReachableSpatialNodes(projectId: number, canonicalParent: Map<number, number>): Set<number>;
|
|
36
86
|
//# sourceMappingURL=spatial-hierarchy-canonical-parent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spatial-hierarchy-canonical-parent.d.ts","sourceRoot":"","sources":["../src/spatial-hierarchy-canonical-parent.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"spatial-hierarchy-canonical-parent.d.ts","sourceRoot":"","sources":["../src/spatial-hierarchy-canonical-parent.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAKrE;;;;;;;;;;GAUG;AACH;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,UAAY,CAAC;AA4BlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,WAAW,EACrB,aAAa,EAAE,iBAAiB,EAChC,OAAO,GAAE;IAAE,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/C,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA6FrB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,GAAG,CAAC,MAAM,CAAC,CAsBb"}
|