@ifc-lite/parser 5.1.0 → 5.2.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/classification-resolver.d.ts.map +1 -1
- package/dist/classification-resolver.js +35 -10
- package/dist/classification-resolver.js.map +1 -1
- package/dist/columnar-entity-preparation.d.ts +22 -0
- package/dist/columnar-entity-preparation.d.ts.map +1 -0
- package/dist/columnar-entity-preparation.js +192 -0
- package/dist/columnar-entity-preparation.js.map +1 -0
- package/dist/columnar-parser-root-attributes.d.ts +66 -0
- package/dist/columnar-parser-root-attributes.d.ts.map +1 -0
- package/dist/columnar-parser-root-attributes.js +245 -0
- package/dist/columnar-parser-root-attributes.js.map +1 -0
- package/dist/columnar-parser.d.ts +16 -62
- package/dist/columnar-parser.d.ts.map +1 -1
- package/dist/columnar-parser.js +371 -750
- package/dist/columnar-parser.js.map +1 -1
- package/dist/compact-entity-index-columns.d.ts +17 -0
- package/dist/compact-entity-index-columns.d.ts.map +1 -0
- package/dist/compact-entity-index-columns.js +15 -0
- package/dist/compact-entity-index-columns.js.map +1 -0
- package/dist/compact-entity-index-transport.d.ts +2 -12
- package/dist/compact-entity-index-transport.d.ts.map +1 -1
- package/dist/compact-entity-index-transport.js +1 -11
- package/dist/compact-entity-index-transport.js.map +1 -1
- package/dist/compact-entity-index.d.ts +6 -0
- package/dist/compact-entity-index.d.ts.map +1 -1
- package/dist/compact-entity-index.js +12 -20
- package/dist/compact-entity-index.js.map +1 -1
- package/dist/data-store-transport.d.ts +2 -2
- package/dist/data-store-transport.d.ts.map +1 -1
- package/dist/data-store-transport.js +5 -5
- package/dist/data-store-transport.js.map +1 -1
- package/dist/entity-refs-from-index.d.ts +10 -0
- package/dist/entity-refs-from-index.d.ts.map +1 -1
- package/dist/entity-refs-from-index.js +52 -36
- package/dist/entity-refs-from-index.js.map +1 -1
- package/dist/entity-scanner.d.ts +5 -0
- package/dist/entity-scanner.d.ts.map +1 -1
- package/dist/entity-scanner.js +20 -7
- package/dist/entity-scanner.js.map +1 -1
- package/dist/entity-type-byte-interner.d.ts +12 -0
- package/dist/entity-type-byte-interner.d.ts.map +1 -0
- package/dist/entity-type-byte-interner.js +66 -0
- package/dist/entity-type-byte-interner.js.map +1 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/parser.worker.d.ts +6 -3
- package/dist/parser.worker.d.ts.map +1 -1
- package/dist/parser.worker.js +24 -12
- package/dist/parser.worker.js.map +1 -1
- package/dist/prepass-source-fingerprint.d.ts +3 -0
- package/dist/prepass-source-fingerprint.d.ts.map +1 -0
- package/dist/prepass-source-fingerprint.js +13 -0
- package/dist/prepass-source-fingerprint.js.map +1 -0
- package/dist/select-entity-columns.d.ts +7 -0
- package/dist/select-entity-columns.d.ts.map +1 -0
- package/dist/select-entity-columns.js +43 -0
- package/dist/select-entity-columns.js.map +1 -0
- package/dist/spatial-hierarchy-builder.d.ts +6 -8
- package/dist/spatial-hierarchy-builder.d.ts.map +1 -1
- package/dist/spatial-hierarchy-builder.js +4 -0
- package/dist/spatial-hierarchy-builder.js.map +1 -1
- package/dist/spatial-hierarchy-canonical-parent.d.ts +36 -0
- package/dist/spatial-hierarchy-canonical-parent.d.ts.map +1 -0
- package/dist/spatial-hierarchy-canonical-parent.js +63 -0
- package/dist/spatial-hierarchy-canonical-parent.js.map +1 -0
- package/dist/worker-index-publication.d.ts +43 -0
- package/dist/worker-index-publication.d.ts.map +1 -0
- package/dist/worker-index-publication.js +129 -0
- package/dist/worker-index-publication.js.map +1 -0
- package/dist/worker-parser.d.ts +5 -2
- package/dist/worker-parser.d.ts.map +1 -1
- package/dist/worker-parser.js +22 -10
- package/dist/worker-parser.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classification-resolver.d.ts","sourceRoot":"","sources":["../src/classification-resolver.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC1C,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,MAAM,GACjB,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"classification-resolver.d.ts","sourceRoot":"","sources":["../src/classification-resolver.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC1C,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,MAAM,GACjB,kBAAkB,EAAE,CA6GtB;AAED,8DAA8D;AAC9D,MAAM,WAAW,yBAAyB;IACtC;;uCAEmC;IACnC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;;;;;;OAOG;IACH,UAAU,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,YAAY,GAAG,yBAAyB,CA2BnG"}
|
|
@@ -46,16 +46,41 @@ export function extractClassificationsOnDemand(store, entityId) {
|
|
|
46
46
|
if (!classRefIds || classRefIds.length === 0)
|
|
47
47
|
return [];
|
|
48
48
|
if (!store.source?.length) {
|
|
49
|
-
// Server-parsed / source-empty store:
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
49
|
+
// Server-parsed / source-empty store: no source bytes to decode the
|
|
50
|
+
// classification reference's own attributes. The relationship graph
|
|
51
|
+
// above already proved this entity (or its type) IS classified — the
|
|
52
|
+
// ids resolved into `classRefIds` are real
|
|
53
|
+
// `IfcRelAssociatesClassification` targets.
|
|
54
|
+
//
|
|
55
|
+
// If the server also forwarded the resolved attributes (issue
|
|
56
|
+
// #3955), prefer those — real system/identification/name data beats
|
|
57
|
+
// a marker. Roll up the entity's own row plus its type's (mirroring
|
|
58
|
+
// the classRefIds roll-up above) so a type-level classification is
|
|
59
|
+
// not dropped.
|
|
60
|
+
if (store.resolvedClassifications) {
|
|
61
|
+
const resolved = [...(store.resolvedClassifications.get(entityId) || [])];
|
|
62
|
+
if (store.relationships) {
|
|
63
|
+
const typeIds = store.relationships.getRelated(entityId, RelationshipType.DefinesByType, 'inverse');
|
|
64
|
+
for (const typeId of typeIds) {
|
|
65
|
+
const typeResolved = store.resolvedClassifications.get(typeId);
|
|
66
|
+
if (typeResolved)
|
|
67
|
+
resolved.push(...typeResolved);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// The server resolves these rows from the same immutable input
|
|
71
|
+
// as its graph. Repeated relationships emit repeated rows while
|
|
72
|
+
// the graph deduplicates edges, so their counts need not match.
|
|
73
|
+
if (resolved.length > 0)
|
|
74
|
+
return resolved;
|
|
75
|
+
}
|
|
76
|
+
// No forwarded resolved data. Turning an id into
|
|
77
|
+
// system/identification/name/path needs raw STEP bytes
|
|
78
|
+
// (`EntityExtractor`), which this store doesn't have. Previously
|
|
79
|
+
// this silently returned `[]` here, making a classified entity
|
|
80
|
+
// byte-identical to a genuinely unclassified one (issue #3948).
|
|
81
|
+
// Surface one unresolved marker per resolved id instead, so callers
|
|
82
|
+
// — the IDS bridge in particular — can tell "classified, but this
|
|
83
|
+
// data source can't say more" from "none".
|
|
59
84
|
return classRefIds.map(() => ({ unresolved: true }));
|
|
60
85
|
}
|
|
61
86
|
const extractor = new EntityExtractor(store.source);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classification-resolver.js","sourceRoot":"","sources":["../src/classification-resolver.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAsBlD;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAC1C,KAAmB,EACnB,QAAgB;IAEhB,IAAI,WAAiC,CAAC;IAEtC,IAAI,KAAK,CAAC,yBAAyB,EAAE,CAAC;QAClC,WAAW,GAAG,KAAK,CAAC,yBAAyB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAChE,CAAC;SAAM,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;QAC7B,0DAA0D;QAC1D,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,gBAAgB,CAAC,wBAAwB,EAAE,SAAS,CAAC,CAAC;QAC/G,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;YAAE,WAAW,GAAG,OAAO,CAAC;IAClD,CAAC;IAED,gEAAgE;IAChE,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;QACtB,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,gBA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,CAAC;aAAM,CAAC;YACJ,MAAM;QACV,CAAC;IACL,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EntityRef } from './types.js';
|
|
2
|
+
import type { ScannedEntityColumns } from './entity-refs-from-index.js';
|
|
3
|
+
export type ColumnarEntityInput = EntityRef[] | ScannedEntityColumns;
|
|
4
|
+
/** Shared categorization for scanned objects and pre-pass columns. #3985 */
|
|
5
|
+
export declare function prepareColumnarEntities(input: ColumnarEntityInput, deferPropertyAtomIndex: boolean, yieldIfNeeded: () => Promise<void>): Promise<{
|
|
6
|
+
byType: Map<string, number[]>;
|
|
7
|
+
getTypeUpper: (type: string) => string;
|
|
8
|
+
indexedCount: number;
|
|
9
|
+
propertyAtomCount: number;
|
|
10
|
+
spatialRefs: EntityRef[];
|
|
11
|
+
geometryRefs: EntityRef[];
|
|
12
|
+
relationshipRefs: EntityRef[];
|
|
13
|
+
propertyRelRefs: EntityRef[];
|
|
14
|
+
propertyContainerRefs: EntityRef[];
|
|
15
|
+
associationRelRefs: EntityRef[];
|
|
16
|
+
typeObjectRefs: EntityRef[];
|
|
17
|
+
otherRelevantRefs: EntityRef[];
|
|
18
|
+
groupRefs: EntityRef[];
|
|
19
|
+
buildPrimaryIndex(): Promise<import("./compact-entity-index.js").CompactEntityIndex>;
|
|
20
|
+
buildDeferredIndex(): Promise<import("./compact-entity-index.js").CompactEntityIndex | undefined>;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=columnar-entity-preparation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columnar-entity-preparation.d.ts","sourceRoot":"","sources":["../src/columnar-entity-preparation.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAUxE,MAAM,MAAM,mBAAmB,GAAG,SAAS,EAAE,GAAG,oBAAoB,CAAC;AAErE,4EAA4E;AAC5E,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,mBAAmB,EAC1B,sBAAsB,EAAE,OAAO,EAC/B,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC;;yBAON,MAAM;;;;;;;;;;;;;;GA+JnC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
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 { compactEntityIndexFromColumns } from './compact-entity-index-transport.js';
|
|
5
|
+
import { buildCompactEntityIndexAsync } from './compact-entity-index.js';
|
|
6
|
+
import { selectEntityColumns } from './select-entity-columns.js';
|
|
7
|
+
import { getInheritanceChain } from './ifc-schema.js';
|
|
8
|
+
import { GEOMETRY_TYPES, SPATIAL_TYPES, HIERARCHY_REL_TYPES, PROPERTY_REL_TYPES, PROPERTY_ENTITY_TYPES, PROPERTY_CONTAINER_TYPES, ASSOCIATION_REL_TYPES, isIfcTypeLikeEntity, } from './columnar-parser-indexes.js';
|
|
9
|
+
/** Shared categorization for scanned objects and pre-pass columns. #3985 */
|
|
10
|
+
export async function prepareColumnarEntities(input, deferPropertyAtomIndex, yieldIfNeeded) {
|
|
11
|
+
// Single pass: build byType index AND categorize entities simultaneously.
|
|
12
|
+
// Uses a type-name cache to avoid calling .toUpperCase() on 4.4M refs
|
|
13
|
+
// (only ~776 unique type names in IFC4).
|
|
14
|
+
const byType = new Map();
|
|
15
|
+
const typeUpperCache = new Map();
|
|
16
|
+
const getTypeUpper = (type) => {
|
|
17
|
+
let upper = typeUpperCache.get(type);
|
|
18
|
+
if (upper === undefined) {
|
|
19
|
+
upper = type.toUpperCase();
|
|
20
|
+
typeUpperCache.set(type, upper);
|
|
21
|
+
}
|
|
22
|
+
return upper;
|
|
23
|
+
};
|
|
24
|
+
// Non-product helper entities that on-demand extraction / StepExporter
|
|
25
|
+
// need addressable in `byId`. These are not IfcProduct subtypes so the
|
|
26
|
+
// schema-driven IFCPRODUCT subtype check below cannot capture them.
|
|
27
|
+
// Without them, findPreferredGeometricRepresentationContextId() and
|
|
28
|
+
// findLengthUnitReference() fail because the entities are missing from
|
|
29
|
+
// the compact entity index.
|
|
30
|
+
const RELEVANT_NON_PRODUCT_HELPERS = new Set([
|
|
31
|
+
'IFCGEOMETRICREPRESENTATIONCONTEXT', 'IFCGEOMETRICREPRESENTATIONSUBCONTEXT',
|
|
32
|
+
'IFCUNITASSIGNMENT', 'IFCSIUNIT', 'IFCCONVERSIONBASEDUNIT',
|
|
33
|
+
'IFCDERIVEDUNIT', 'IFCDERIVEDUNITELEMENT', 'IFCMEASUREWITHUNIT',
|
|
34
|
+
'IFCDIMENSIONALEXPONENTS',
|
|
35
|
+
'IFCMAPCONVERSION', 'IFCPROJECTEDCRS',
|
|
36
|
+
'IFCMATERIALLAYER', 'IFCMATERIALLAYERSET', 'IFCMATERIALLAYERSETUSAGE',
|
|
37
|
+
'IFCMATERIALCONSTITUENTSET', 'IFCMATERIALCONSTITUENT',
|
|
38
|
+
'IFCMATERIALPROFILESET', 'IFCMATERIALPROFILE', 'IFCMATERIAL',
|
|
39
|
+
'IFCCLASSIFICATION', 'IFCCLASSIFICATIONREFERENCE',
|
|
40
|
+
'IFCDOCUMENTINFORMATION', 'IFCDOCUMENTREFERENCE',
|
|
41
|
+
]);
|
|
42
|
+
// Schema-driven inclusion: every IfcProduct subtype belongs in the
|
|
43
|
+
// EntityTable. The previous hardcoded enumeration of IFC4 building-
|
|
44
|
+
// element leaves (IFCWALL, IFCSLAB, …) and IFC4x3 infrastructure
|
|
45
|
+
// leaves (IFCREFERENT, IFCSIGNAL, IFCALIGNMENT, IFCPAVEMENT, …) drifted
|
|
46
|
+
// with every schema bump — new entities silently became CAT_SKIP and
|
|
47
|
+
// disappeared from the hierarchy panel. The generated schema registry
|
|
48
|
+
// already knows the full inheritance chain, so use it.
|
|
49
|
+
const RELEVANT_PRODUCT_ROOTS = new Set(['IFCPRODUCT']);
|
|
50
|
+
// IfcGroup family (IfcZone, IfcSystem, IfcDistributionSystem,
|
|
51
|
+
// IfcBuildingSystem, IfcDistributionCircuit, …). These are NOT
|
|
52
|
+
// IfcProduct subtypes, so without an explicit branch they fall through
|
|
53
|
+
// to CAT_SKIP and never enter the EntityTable — leaving their Name
|
|
54
|
+
// unresolvable (`getName` → '') and making them invisible to
|
|
55
|
+
// `getByType`. The Relationships card then shows "Group #<id>" and the
|
|
56
|
+
// lens/lists can't surface them. Route them into their own bucket so we
|
|
57
|
+
// can extract Name/LongName/ObjectType for the group label (#1075).
|
|
58
|
+
const GROUP_ROOTS = new Set(['IFCGROUP']);
|
|
59
|
+
// Category constants for the lookup cache
|
|
60
|
+
const CAT_SKIP = 0, CAT_SPATIAL = 1, CAT_GEOMETRY = 2, CAT_HIERARCHY_REL = 3, CAT_PROPERTY_REL = 4, CAT_PROPERTY_ENTITY = 5, CAT_ASSOCIATION_REL = 6, CAT_TYPE_OBJECT = 7, CAT_RELEVANT = 8, CAT_GROUP = 9;
|
|
61
|
+
/** Returns true if `upper` (already uppercased) is a subtype of any type in `set`. */
|
|
62
|
+
function isSubtypeOfAny(upper, set) {
|
|
63
|
+
const chain = getInheritanceChain(upper);
|
|
64
|
+
return chain.some(ancestor => set.has(ancestor.toUpperCase()));
|
|
65
|
+
}
|
|
66
|
+
// Cache: type name → category (avoids 4.4M .toUpperCase() calls)
|
|
67
|
+
const typeCategoryCache = new Map();
|
|
68
|
+
function getCategory(type) {
|
|
69
|
+
let cat = typeCategoryCache.get(type);
|
|
70
|
+
if (cat !== undefined)
|
|
71
|
+
return cat;
|
|
72
|
+
const upper = getTypeUpper(type);
|
|
73
|
+
if (SPATIAL_TYPES.has(upper) || isSubtypeOfAny(upper, SPATIAL_TYPES))
|
|
74
|
+
cat = CAT_SPATIAL;
|
|
75
|
+
else if (GEOMETRY_TYPES.has(upper) || isSubtypeOfAny(upper, GEOMETRY_TYPES))
|
|
76
|
+
cat = CAT_GEOMETRY;
|
|
77
|
+
else if (HIERARCHY_REL_TYPES.has(upper))
|
|
78
|
+
cat = CAT_HIERARCHY_REL;
|
|
79
|
+
else if (PROPERTY_REL_TYPES.has(upper))
|
|
80
|
+
cat = CAT_PROPERTY_REL;
|
|
81
|
+
else if (PROPERTY_ENTITY_TYPES.has(upper))
|
|
82
|
+
cat = CAT_PROPERTY_ENTITY;
|
|
83
|
+
else if (ASSOCIATION_REL_TYPES.has(upper))
|
|
84
|
+
cat = CAT_ASSOCIATION_REL;
|
|
85
|
+
else if (isIfcTypeLikeEntity(upper))
|
|
86
|
+
cat = CAT_TYPE_OBJECT;
|
|
87
|
+
else if (isSubtypeOfAny(upper, GROUP_ROOTS))
|
|
88
|
+
cat = CAT_GROUP;
|
|
89
|
+
else if (RELEVANT_NON_PRODUCT_HELPERS.has(upper)
|
|
90
|
+
|| isSubtypeOfAny(upper, RELEVANT_PRODUCT_ROOTS)
|
|
91
|
+
|| upper.startsWith('IFCREL'))
|
|
92
|
+
cat = CAT_RELEVANT;
|
|
93
|
+
else
|
|
94
|
+
cat = CAT_SKIP;
|
|
95
|
+
typeCategoryCache.set(type, cat);
|
|
96
|
+
return cat;
|
|
97
|
+
}
|
|
98
|
+
const refs = Array.isArray(input) ? input : undefined;
|
|
99
|
+
const columns = Array.isArray(input) ? undefined : input;
|
|
100
|
+
const count = refs ? refs.length : columns.expressIds.length;
|
|
101
|
+
const spatialRefs = [];
|
|
102
|
+
const geometryRefs = [];
|
|
103
|
+
const relationshipRefs = [];
|
|
104
|
+
const propertyRelRefs = [];
|
|
105
|
+
const propertyContainerRefs = [];
|
|
106
|
+
const propertyAtomRefs = [];
|
|
107
|
+
const deferredRows = [];
|
|
108
|
+
let propertyAtomCount = 0;
|
|
109
|
+
const associationRelRefs = [];
|
|
110
|
+
const typeObjectRefs = [];
|
|
111
|
+
const otherRelevantRefs = [];
|
|
112
|
+
const groupRefs = [];
|
|
113
|
+
for (let i = 0; i < count; i++) {
|
|
114
|
+
if ((i & 0x3FF) === 0)
|
|
115
|
+
await yieldIfNeeded();
|
|
116
|
+
const type = refs ? refs[i].type : columns.typeStrings[columns.typeIndices[i]];
|
|
117
|
+
const id = refs ? refs[i].expressId : columns.expressIds[i];
|
|
118
|
+
const cat = getCategory(type);
|
|
119
|
+
const atom = cat === CAT_PROPERTY_ENTITY && !PROPERTY_CONTAINER_TYPES.has(getTypeUpper(type));
|
|
120
|
+
if (!deferPropertyAtomIndex || !atom) {
|
|
121
|
+
const typeKey = getTypeUpper(type);
|
|
122
|
+
let list = byType.get(typeKey);
|
|
123
|
+
if (!list) {
|
|
124
|
+
list = [];
|
|
125
|
+
byType.set(typeKey, list);
|
|
126
|
+
}
|
|
127
|
+
list.push(id);
|
|
128
|
+
}
|
|
129
|
+
if (atom) {
|
|
130
|
+
propertyAtomCount++;
|
|
131
|
+
if (deferPropertyAtomIndex) {
|
|
132
|
+
if (refs)
|
|
133
|
+
propertyAtomRefs.push(refs[i]);
|
|
134
|
+
else
|
|
135
|
+
deferredRows.push(i);
|
|
136
|
+
}
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
// Helper records still remain in both complete indexes. They do not need
|
|
140
|
+
// a transient EntityRef merely to copy their numeric fields back out.
|
|
141
|
+
if (cat === CAT_SKIP)
|
|
142
|
+
continue;
|
|
143
|
+
const ref = refs ? refs[i] : {
|
|
144
|
+
expressId: id, type, byteOffset: columns.byteOffsets[i],
|
|
145
|
+
byteLength: columns.byteLengths[i], lineNumber: 0,
|
|
146
|
+
};
|
|
147
|
+
if (cat === CAT_SPATIAL)
|
|
148
|
+
spatialRefs.push(ref);
|
|
149
|
+
else if (cat === CAT_GEOMETRY)
|
|
150
|
+
geometryRefs.push(ref);
|
|
151
|
+
else if (cat === CAT_HIERARCHY_REL)
|
|
152
|
+
relationshipRefs.push(ref);
|
|
153
|
+
else if (cat === CAT_PROPERTY_REL)
|
|
154
|
+
propertyRelRefs.push(ref);
|
|
155
|
+
else if (cat === CAT_PROPERTY_ENTITY)
|
|
156
|
+
propertyContainerRefs.push(ref);
|
|
157
|
+
else if (cat === CAT_ASSOCIATION_REL)
|
|
158
|
+
associationRelRefs.push(ref);
|
|
159
|
+
else if (cat === CAT_TYPE_OBJECT)
|
|
160
|
+
typeObjectRefs.push(ref);
|
|
161
|
+
else if (cat === CAT_GROUP)
|
|
162
|
+
groupRefs.push(ref);
|
|
163
|
+
else if (cat === CAT_RELEVANT)
|
|
164
|
+
otherRelevantRefs.push(ref);
|
|
165
|
+
}
|
|
166
|
+
const isPrimary = (type) => !deferPropertyAtomIndex
|
|
167
|
+
|| getCategory(type) !== CAT_PROPERTY_ENTITY || PROPERTY_CONTAINER_TYPES.has(getTypeUpper(type));
|
|
168
|
+
const indexedCount = count - (deferPropertyAtomIndex ? propertyAtomCount : 0);
|
|
169
|
+
return {
|
|
170
|
+
byType, getTypeUpper, indexedCount, propertyAtomCount,
|
|
171
|
+
spatialRefs, geometryRefs, relationshipRefs, propertyRelRefs,
|
|
172
|
+
propertyContainerRefs, associationRelRefs, typeObjectRefs, otherRelevantRefs, groupRefs,
|
|
173
|
+
async buildPrimaryIndex() {
|
|
174
|
+
if (refs)
|
|
175
|
+
return buildCompactEntityIndexAsync(deferPropertyAtomIndex ? refs.filter(ref => isPrimary(ref.type)) : refs);
|
|
176
|
+
if (!deferPropertyAtomIndex || propertyAtomCount === 0)
|
|
177
|
+
return compactEntityIndexFromColumns({
|
|
178
|
+
...columns, typeIndices: columns.typeIndices instanceof Uint16Array
|
|
179
|
+
? columns.typeIndices : Uint16Array.from(columns.typeIndices),
|
|
180
|
+
});
|
|
181
|
+
return selectEntityColumns(columns, indexedCount, isPrimary);
|
|
182
|
+
},
|
|
183
|
+
async buildDeferredIndex() {
|
|
184
|
+
if (!deferPropertyAtomIndex || propertyAtomCount === 0)
|
|
185
|
+
return undefined;
|
|
186
|
+
if (refs)
|
|
187
|
+
return buildCompactEntityIndexAsync(propertyAtomRefs, undefined, 1024, 2);
|
|
188
|
+
return selectEntityColumns(columns, propertyAtomCount, undefined, deferredRows, 1024, 2);
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=columnar-entity-preparation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columnar-entity-preparation.js","sourceRoot":"","sources":["../src/columnar-entity-preparation.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAI/D,OAAO,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EACL,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EACtE,qBAAqB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,mBAAmB,GAC5F,MAAM,8BAA8B,CAAC;AAItC,4EAA4E;AAC5E,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,KAA0B,EAC1B,sBAA+B,EAC/B,aAAkC;IAElC,0EAA0E;IAC1E,sEAAsE;IACtE,yCAAyC;IACzC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC3C,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IACjD,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;QAClC,IAAI,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YAC3B,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACpC,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
+
import type { EntityRef } from './types.js';
|
|
2
|
+
import type { IfcEntity, IfcAttributeValue } from '@ifc-lite/data';
|
|
3
|
+
import type { IfcDataStore } from './columnar-parser.js';
|
|
4
|
+
export declare function getEntityRefFromStore(store: IfcDataStore, expressId: number): EntityRef | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Extract entity attributes on-demand from source buffer.
|
|
7
|
+
* Returns globalId, name, description, objectType, tag mapped by schema name
|
|
8
|
+
* (see {@link extractRootAttributesFromEntity}), so the result stays correct
|
|
9
|
+
* for entity types whose attribute order differs from the IfcElement layout.
|
|
10
|
+
* This is used for entities that weren't fully parsed during initial load.
|
|
11
|
+
*/
|
|
12
|
+
export declare function extractEntityAttributesOnDemand(store: IfcDataStore, entityId: number): {
|
|
13
|
+
globalId: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
objectType: string;
|
|
17
|
+
tag: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Extract ALL named entity attributes on-demand from source buffer.
|
|
21
|
+
* Uses the IFC schema to map attribute indices to names.
|
|
22
|
+
* Returns only string/enum attributes, skipping references and structural attributes.
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractAllEntityAttributes(store: IfcDataStore, entityId: number): Array<{
|
|
25
|
+
name: string;
|
|
26
|
+
value: string | number | boolean;
|
|
27
|
+
}>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns named raw attribute pairs for an entity, filtered to display-relevant attributes.
|
|
30
|
+
* Skips structural/reference attributes using the IFC schema. Used by query layer for coercion.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getRawNamedAttributes(entity: IfcEntity): Array<{
|
|
33
|
+
name: string;
|
|
34
|
+
raw: IfcAttributeValue;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the common IfcRoot-family display attributes (GlobalId, Name,
|
|
38
|
+
* Description, ObjectType, Tag) from an entity's raw attribute array.
|
|
39
|
+
*
|
|
40
|
+
* These are mapped by schema-derived attribute *name*, not fixed index. The
|
|
41
|
+
* fixed indices `[0],[2],[3],[4],[7]` only hold for the IfcElement layout: for
|
|
42
|
+
* a spatial element `attrs[7]` is LongName (not Tag), and for a resource entity
|
|
43
|
+
* like IfcMaterial `attrs[0]` is Name (not GlobalId). Name-mapping keeps all of
|
|
44
|
+
* these correct for every entity type, returning '' for attributes the type
|
|
45
|
+
* does not declare.
|
|
46
|
+
*
|
|
47
|
+
* For types the schema registry does not recognise (e.g. an IFC4x3 infra leaf
|
|
48
|
+
* outside the codegen pin, or a vendor extension) we fall back to the canonical
|
|
49
|
+
* IfcRoot/IfcElement positions so we never regress vs. the old fixed-index path.
|
|
50
|
+
*/
|
|
51
|
+
export declare function extractRootAttributesFromEntity(entity: IfcEntity): {
|
|
52
|
+
globalId: string;
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
objectType: string;
|
|
56
|
+
tag: string;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Resolve an entity's LongName (IfcZone, IfcSystem subtypes, IfcSpatialZone,
|
|
60
|
+
* IfcBuildingSystem, …) by schema attribute name. Groups frequently leave Name
|
|
61
|
+
* empty and carry their human label in LongName, so consumers fall back to this
|
|
62
|
+
* for the display label. Returns '' when the type does not declare LongName.
|
|
63
|
+
* (#1075)
|
|
64
|
+
*/
|
|
65
|
+
export declare function pickLongName(entity: IfcEntity): string;
|
|
66
|
+
//# sourceMappingURL=columnar-parser-root-attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"columnar-parser-root-attributes.d.ts","sourceRoot":"","sources":["../src/columnar-parser-root-attributes.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAEnG;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC3C,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,MAAM,GACjB;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAa1F;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACtC,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,MAAM,GACjB,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC,CAoG3D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACjC,MAAM,EAAE,SAAS,GAClB,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,iBAAiB,CAAA;CAAE,CAAC,CAYjD;AAoCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,+BAA+B,CAC3C,MAAM,EAAE,SAAS,GAClB;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CA0B1F;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAKtD"}
|
|
@@ -0,0 +1,245 @@
|
|
|
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
|
+
* Root-attribute resolution for on-demand entity extraction.
|
|
6
|
+
* Extracted from columnar-parser.ts to keep that module under its size budget.
|
|
7
|
+
*
|
|
8
|
+
* Resolves the common IfcRoot-family display attributes (GlobalId, Name,
|
|
9
|
+
* Description, ObjectType, Tag, LongName) from a raw entity's attribute
|
|
10
|
+
* array by schema-derived attribute name, plus the on-demand "all named
|
|
11
|
+
* attributes" extraction used by the query layer's IDS/property coercion.
|
|
12
|
+
*/
|
|
13
|
+
import { EntityExtractor } from './entity-extractor.js';
|
|
14
|
+
import { getAttributeNames, getAttributeNamesAcrossSchemas } from './ifc-schema.js';
|
|
15
|
+
import { SKIP_DISPLAY_ATTRS } from './columnar-parser-indexes.js';
|
|
16
|
+
export function getEntityRefFromStore(store, expressId) {
|
|
17
|
+
return store.entityIndex.byId.get(expressId) ?? store.deferredEntityIndex?.get(expressId);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Extract entity attributes on-demand from source buffer.
|
|
21
|
+
* Returns globalId, name, description, objectType, tag mapped by schema name
|
|
22
|
+
* (see {@link extractRootAttributesFromEntity}), so the result stays correct
|
|
23
|
+
* for entity types whose attribute order differs from the IfcElement layout.
|
|
24
|
+
* This is used for entities that weren't fully parsed during initial load.
|
|
25
|
+
*/
|
|
26
|
+
export function extractEntityAttributesOnDemand(store, entityId) {
|
|
27
|
+
const ref = store.entityIndex.byId.get(entityId);
|
|
28
|
+
if (!ref) {
|
|
29
|
+
return { globalId: '', name: '', description: '', objectType: '', tag: '' };
|
|
30
|
+
}
|
|
31
|
+
const extractor = new EntityExtractor(store.source);
|
|
32
|
+
const entity = extractor.extractEntity(ref);
|
|
33
|
+
if (!entity) {
|
|
34
|
+
return { globalId: '', name: '', description: '', objectType: '', tag: '' };
|
|
35
|
+
}
|
|
36
|
+
return extractRootAttributesFromEntity(entity);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Extract ALL named entity attributes on-demand from source buffer.
|
|
40
|
+
* Uses the IFC schema to map attribute indices to names.
|
|
41
|
+
* Returns only string/enum attributes, skipping references and structural attributes.
|
|
42
|
+
*/
|
|
43
|
+
export function extractAllEntityAttributes(store, entityId) {
|
|
44
|
+
const ref = store.entityIndex.byId.get(entityId);
|
|
45
|
+
if (!ref)
|
|
46
|
+
return [];
|
|
47
|
+
const extractor = new EntityExtractor(store.source);
|
|
48
|
+
const entity = extractor.extractEntity(ref);
|
|
49
|
+
if (!entity)
|
|
50
|
+
return [];
|
|
51
|
+
const attrs = entity.attributes || [];
|
|
52
|
+
// Use properly-cased type name from entity table (IfcTypeEnumToString)
|
|
53
|
+
// instead of ref.type which is UPPERCASE from STEP (e.g., IFCWALLSTANDARDCASE)
|
|
54
|
+
// and breaks multi-word type normalization in getAttributeNames.
|
|
55
|
+
// For resource-level entities (IfcTask, IfcTaskTime, IfcMaterial,
|
|
56
|
+
// IfcClassification, ...) the entity table returns 'Unknown';
|
|
57
|
+
// fall back to ref.type so the schema-driven attribute-name
|
|
58
|
+
// resolution still works for those types.
|
|
59
|
+
const tableName = store.entities.getTypeName(entityId);
|
|
60
|
+
const typeName = tableName && tableName !== 'Unknown' ? tableName : ref.type;
|
|
61
|
+
// Named across the bundled schema union (2X3 + 4 + 4X3), not through the
|
|
62
|
+
// IFC4 codegen pin alone. The pin answers an EMPTY list — not a wrong one —
|
|
63
|
+
// for every class it does not carry, and 251 real classes are outside it:
|
|
64
|
+
// the IFC2X3 ones IFC4 dropped and the whole IFC4X3 infrastructure
|
|
65
|
+
// vocabulary (`IfcCourse`, `IfcPavement`, `IfcKerb`, `IfcSignal`, `IfcRoad`,
|
|
66
|
+
// …). An empty list means this function returns NO attributes for such an
|
|
67
|
+
// entity, so every caller that looks one up by name silently finds nothing
|
|
68
|
+
// and cannot tell that apart from an unset slot. The model-diff adapters
|
|
69
|
+
// read `PredefinedType` this way, which made a cleared `PredefinedType` —
|
|
70
|
+
// the single most common edit in a real infrastructure revision — compare
|
|
71
|
+
// equal to itself on exactly the classes IFC4X3 exists for. Same pinned-
|
|
72
|
+
// registry family as #2001/#2003/#2021.
|
|
73
|
+
//
|
|
74
|
+
// Provably additive: `getAttributeNamesAcrossSchemas` returns the pinned
|
|
75
|
+
// result unchanged whenever the pin has one, so no IFC2X3 or IFC4 entity's
|
|
76
|
+
// attribute list — or the hash anyone derives from it — moves.
|
|
77
|
+
const attrNames = getAttributeNamesAcrossSchemas(typeName);
|
|
78
|
+
const result = [];
|
|
79
|
+
const len = Math.min(attrs.length, attrNames.length);
|
|
80
|
+
for (let i = 0; i < len; i++) {
|
|
81
|
+
const attrName = attrNames[i];
|
|
82
|
+
if (SKIP_DISPLAY_ATTRS.has(attrName))
|
|
83
|
+
continue;
|
|
84
|
+
const raw = attrs[i];
|
|
85
|
+
// STEP `$` (unset) and `*` (derived) deserialize as null /
|
|
86
|
+
// undefined and must be skipped. Strings are emitted with
|
|
87
|
+
// `.ENUM.` markers stripped. Empty strings are preserved so
|
|
88
|
+
// IDS optional-attribute checks can distinguish "slot truly
|
|
89
|
+
// absent" from "slot explicitly empty". Numbers and booleans
|
|
90
|
+
// pass through unchanged so e.g. `CountValue = 0` reads as
|
|
91
|
+
// present.
|
|
92
|
+
if (typeof raw === 'string') {
|
|
93
|
+
// STEP logical-unknown markers (`.U.`, `.X.`) read as
|
|
94
|
+
// "no value" per IDS spec — they fail any attribute
|
|
95
|
+
// check, including a bare existence check, so don't
|
|
96
|
+
// surface them as if the slot were populated.
|
|
97
|
+
if (raw === '.U.' || raw === '.X.')
|
|
98
|
+
continue;
|
|
99
|
+
// Bare boolean tokens (`.T.` / `.F.`) on a schema-typed
|
|
100
|
+
// IfcBoolean attribute slot — resolve to JS boolean so
|
|
101
|
+
// IDS checks comparing against `true` / `false` literals
|
|
102
|
+
// pass without case-sensitive string contortions.
|
|
103
|
+
if (raw === '.T.') {
|
|
104
|
+
result.push({ name: attrName, value: true });
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (raw === '.F.') {
|
|
108
|
+
result.push({ name: attrName, value: false });
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const display = raw.startsWith('.') && raw.endsWith('.')
|
|
112
|
+
? raw.slice(1, -1)
|
|
113
|
+
: raw;
|
|
114
|
+
result.push({ name: attrName, value: display });
|
|
115
|
+
}
|
|
116
|
+
else if (typeof raw === 'number' || typeof raw === 'boolean') {
|
|
117
|
+
result.push({ name: attrName, value: raw });
|
|
118
|
+
}
|
|
119
|
+
else if (Array.isArray(raw) && raw.length === 2) {
|
|
120
|
+
// Typed STEP values like IFCREAL(0.0), IFCBOOLEAN(.T.) —
|
|
121
|
+
// return the underlying primitive so attribute existence
|
|
122
|
+
// and value checks can compare it directly.
|
|
123
|
+
const inner = raw[1];
|
|
124
|
+
const tag = String(raw[0]).toUpperCase();
|
|
125
|
+
if (tag.includes('BOOLEAN')) {
|
|
126
|
+
result.push({ name: attrName, value: inner === '.T.' || inner === true });
|
|
127
|
+
}
|
|
128
|
+
else if (tag.includes('LOGICAL')) {
|
|
129
|
+
if (inner === '.U.' || inner === '.X.') {
|
|
130
|
+
// UNKNOWN logical → don't surface (treated as absent)
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
result.push({ name: attrName, value: inner === '.T.' || inner === true });
|
|
134
|
+
}
|
|
135
|
+
else if (typeof inner === 'number' || typeof inner === 'boolean') {
|
|
136
|
+
result.push({ name: attrName, value: inner });
|
|
137
|
+
}
|
|
138
|
+
else if (typeof inner === 'string' && inner) {
|
|
139
|
+
const display = inner.startsWith('.') && inner.endsWith('.')
|
|
140
|
+
? inner.slice(1, -1)
|
|
141
|
+
: inner;
|
|
142
|
+
result.push({ name: attrName, value: display });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Returns named raw attribute pairs for an entity, filtered to display-relevant attributes.
|
|
150
|
+
* Skips structural/reference attributes using the IFC schema. Used by query layer for coercion.
|
|
151
|
+
*/
|
|
152
|
+
export function getRawNamedAttributes(entity) {
|
|
153
|
+
const attrs = entity.attributes || [];
|
|
154
|
+
const attrNames = getAttributeNames(entity.type);
|
|
155
|
+
const result = [];
|
|
156
|
+
const len = Math.min(attrs.length, attrNames.length);
|
|
157
|
+
for (let i = 0; i < len; i++) {
|
|
158
|
+
const attrName = attrNames[i];
|
|
159
|
+
if (SKIP_DISPLAY_ATTRS.has(attrName))
|
|
160
|
+
continue;
|
|
161
|
+
result.push({ name: attrName, raw: attrs[i] });
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
// getAttributeNames() walks the schema registry (an O(types) scan for the
|
|
166
|
+
// UPPERCASE STEP names entities carry), so memoise the per-type index lookup.
|
|
167
|
+
// There are only a few hundred distinct types but potentially millions of
|
|
168
|
+
// entities, keeping the on-demand path cheap even when called per entity.
|
|
169
|
+
const rootAttrIndexCache = new Map();
|
|
170
|
+
function getRootAttrIndices(type) {
|
|
171
|
+
let idx = rootAttrIndexCache.get(type);
|
|
172
|
+
if (!idx) {
|
|
173
|
+
const names = getAttributeNames(type);
|
|
174
|
+
idx = {
|
|
175
|
+
known: names.length > 0,
|
|
176
|
+
globalId: names.indexOf('GlobalId'),
|
|
177
|
+
name: names.indexOf('Name'),
|
|
178
|
+
description: names.indexOf('Description'),
|
|
179
|
+
objectType: names.indexOf('ObjectType'),
|
|
180
|
+
tag: names.indexOf('Tag'),
|
|
181
|
+
longName: names.indexOf('LongName'),
|
|
182
|
+
};
|
|
183
|
+
rootAttrIndexCache.set(type, idx);
|
|
184
|
+
}
|
|
185
|
+
return idx;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Resolve the common IfcRoot-family display attributes (GlobalId, Name,
|
|
189
|
+
* Description, ObjectType, Tag) from an entity's raw attribute array.
|
|
190
|
+
*
|
|
191
|
+
* These are mapped by schema-derived attribute *name*, not fixed index. The
|
|
192
|
+
* fixed indices `[0],[2],[3],[4],[7]` only hold for the IfcElement layout: for
|
|
193
|
+
* a spatial element `attrs[7]` is LongName (not Tag), and for a resource entity
|
|
194
|
+
* like IfcMaterial `attrs[0]` is Name (not GlobalId). Name-mapping keeps all of
|
|
195
|
+
* these correct for every entity type, returning '' for attributes the type
|
|
196
|
+
* does not declare.
|
|
197
|
+
*
|
|
198
|
+
* For types the schema registry does not recognise (e.g. an IFC4x3 infra leaf
|
|
199
|
+
* outside the codegen pin, or a vendor extension) we fall back to the canonical
|
|
200
|
+
* IfcRoot/IfcElement positions so we never regress vs. the old fixed-index path.
|
|
201
|
+
*/
|
|
202
|
+
export function extractRootAttributesFromEntity(entity) {
|
|
203
|
+
const attrs = entity.attributes || [];
|
|
204
|
+
const enumIdx = entity.enumAttrIndices;
|
|
205
|
+
const idx = getRootAttrIndices(entity.type);
|
|
206
|
+
const pick = (schemaIndex, fallbackIndex) => {
|
|
207
|
+
const i = idx.known ? schemaIndex : fallbackIndex;
|
|
208
|
+
const raw = i >= 0 ? attrs[i] : undefined;
|
|
209
|
+
if (typeof raw !== 'string')
|
|
210
|
+
return '';
|
|
211
|
+
// Unknown-type fallback only: a fixed index can land on a STEP bare-enum
|
|
212
|
+
// token — e.g. a PredefinedType at attr 7 for a non-IfcElement layout —
|
|
213
|
+
// which must not leak into a Tag/Description cell. Reject by token KIND
|
|
214
|
+
// via the extractor's side channel (#1799), not by dotted-string shape:
|
|
215
|
+
// a quoted string that merely looks like an enum ('.USERDEFINED.')
|
|
216
|
+
// survives, exactly matching the Rust server path (string_at accepts
|
|
217
|
+
// AttributeValue::String and rejects ::Enum, #1779). Skipped for known
|
|
218
|
+
// types, whose schema indices point at genuine string slots.
|
|
219
|
+
if (!idx.known && enumIdx !== undefined && enumIdx.includes(i))
|
|
220
|
+
return '';
|
|
221
|
+
return raw;
|
|
222
|
+
};
|
|
223
|
+
return {
|
|
224
|
+
globalId: pick(idx.globalId, 0),
|
|
225
|
+
name: pick(idx.name, 2),
|
|
226
|
+
description: pick(idx.description, 3),
|
|
227
|
+
objectType: pick(idx.objectType, 4),
|
|
228
|
+
tag: pick(idx.tag, 7),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Resolve an entity's LongName (IfcZone, IfcSystem subtypes, IfcSpatialZone,
|
|
233
|
+
* IfcBuildingSystem, …) by schema attribute name. Groups frequently leave Name
|
|
234
|
+
* empty and carry their human label in LongName, so consumers fall back to this
|
|
235
|
+
* for the display label. Returns '' when the type does not declare LongName.
|
|
236
|
+
* (#1075)
|
|
237
|
+
*/
|
|
238
|
+
export function pickLongName(entity) {
|
|
239
|
+
const idx = getRootAttrIndices(entity.type);
|
|
240
|
+
if (!idx.known || idx.longName < 0)
|
|
241
|
+
return '';
|
|
242
|
+
const raw = (entity.attributes || [])[idx.longName];
|
|
243
|
+
return typeof raw === 'string' ? raw : '';
|
|
244
|
+
}
|
|
245
|
+
//# sourceMappingURL=columnar-parser-root-attributes.js.map
|