@ifc-lite/export 4.7.2 → 4.7.4
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/merged-decomposition-parents.d.ts +99 -0
- package/dist/merged-decomposition-parents.d.ts.map +1 -0
- package/dist/merged-decomposition-parents.js +142 -0
- package/dist/merged-decomposition-parents.js.map +1 -0
- package/dist/merged-empty-containers-refs.d.ts +24 -0
- package/dist/merged-empty-containers-refs.d.ts.map +1 -0
- package/dist/merged-empty-containers-refs.js +126 -0
- package/dist/merged-empty-containers-refs.js.map +1 -0
- package/dist/merged-empty-containers.d.ts +31 -0
- package/dist/merged-empty-containers.d.ts.map +1 -1
- package/dist/merged-empty-containers.js +14 -123
- package/dist/merged-empty-containers.js.map +1 -1
- package/dist/merged-exporter.d.ts +4 -1
- package/dist/merged-exporter.d.ts.map +1 -1
- package/dist/merged-exporter.js +30 -24
- package/dist/merged-exporter.js.map +1 -1
- package/dist/parquet-exporter.d.ts.map +1 -1
- package/dist/parquet-exporter.js +23 -23
- package/dist/parquet-exporter.js.map +1 -1
- package/dist/parquet-spatial-rows.d.ts +14 -0
- package/dist/parquet-spatial-rows.d.ts.map +1 -0
- package/dist/parquet-spatial-rows.js +57 -0
- package/dist/parquet-spatial-rows.js.map +1 -0
- package/package.json +9 -8
- package/dist/merged-rel-aggregates.d.ts +0 -63
- package/dist/merged-rel-aggregates.d.ts.map +0 -1
- package/dist/merged-rel-aggregates.js +0 -122
- package/dist/merged-rel-aggregates.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
/** Resolve the spatial table from the same live relationship edges exported to BOS. */
|
|
5
|
+
export function parquetSpatialRows(relationships, effective) {
|
|
6
|
+
const parentOf = new Map();
|
|
7
|
+
const containerOf = new Map();
|
|
8
|
+
for (let i = 0; i < relationships.RelId.length; i++) {
|
|
9
|
+
const source = relationships.SourceId[i];
|
|
10
|
+
const target = relationships.TargetId[i];
|
|
11
|
+
if (relationships.RelType[i] === 'IfcRelAggregates')
|
|
12
|
+
parentOf.set(target, source);
|
|
13
|
+
if (relationships.RelType[i] === 'IfcRelContainedInSpatialStructure')
|
|
14
|
+
containerOf.set(target, source);
|
|
15
|
+
}
|
|
16
|
+
const rows = [];
|
|
17
|
+
for (const [elementId, containerId] of containerOf) {
|
|
18
|
+
if (!effective.has(elementId))
|
|
19
|
+
continue;
|
|
20
|
+
let storeyId = -1;
|
|
21
|
+
let buildingId = -1;
|
|
22
|
+
let siteId = -1;
|
|
23
|
+
let spaceId = -1;
|
|
24
|
+
let current = containerId;
|
|
25
|
+
const seen = new Set();
|
|
26
|
+
// File-supplied aggregation can cycle. Iteration and the visited set
|
|
27
|
+
// bound the walk without rejecting legitimate deep spatial hierarchies.
|
|
28
|
+
while (current !== undefined && !seen.has(current) && effective.has(current)) {
|
|
29
|
+
seen.add(current);
|
|
30
|
+
switch (effective.typeOf(current)) {
|
|
31
|
+
case 'IFCSPACE':
|
|
32
|
+
if (spaceId < 0)
|
|
33
|
+
spaceId = current;
|
|
34
|
+
break;
|
|
35
|
+
case 'IFCBUILDINGSTOREY':
|
|
36
|
+
if (storeyId < 0)
|
|
37
|
+
storeyId = current;
|
|
38
|
+
break;
|
|
39
|
+
case 'IFCBUILDING':
|
|
40
|
+
if (buildingId < 0)
|
|
41
|
+
buildingId = current;
|
|
42
|
+
break;
|
|
43
|
+
case 'IFCSITE':
|
|
44
|
+
if (siteId < 0)
|
|
45
|
+
siteId = current;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
current = parentOf.get(current);
|
|
49
|
+
}
|
|
50
|
+
if (storeyId < 0)
|
|
51
|
+
continue;
|
|
52
|
+
rows.push({ ElementId: elementId, StoreyId: storeyId, BuildingId: buildingId, SiteId: siteId, SpaceId: spaceId });
|
|
53
|
+
}
|
|
54
|
+
rows.sort((a, b) => a.ElementId - b.ElementId);
|
|
55
|
+
return rows;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=parquet-spatial-rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parquet-spatial-rows.js","sourceRoot":"","sources":["../src/parquet-spatial-rows.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAe/D,uFAAuF;AACvF,MAAM,UAAU,kBAAkB,CAChC,aAA+B,EAC/B,SAA+B;IAE/B,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC3C,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpD,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAE,CAAC;QAC1C,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAE,CAAC;QAC1C,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,kBAAkB;YAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAClF,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,mCAAmC;YAAE,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxG,CAAC;IAED,MAAM,IAAI,GAAiB,EAAE,CAAC;IAC9B,KAAK,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,IAAI,WAAW,EAAE,CAAC;QACnD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC;YAAE,SAAS;QACxC,IAAI,QAAQ,GAAG,CAAC,CAAC,CAAC;QAClB,IAAI,UAAU,GAAG,CAAC,CAAC,CAAC;QACpB,IAA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,CAAC,SAAS,CAAC,CAAC;IAC/C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ifc-lite/export",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.4",
|
|
4
4
|
"description": "Export formats for IFC-Lite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,16 +15,17 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"parquet-wasm": "^0.8.0",
|
|
17
17
|
"apache-arrow": "^21.2.0",
|
|
18
|
-
"
|
|
19
|
-
"@ifc-lite/geometry": "^7.5.
|
|
20
|
-
"@ifc-lite/codegen": "^1.18.
|
|
21
|
-
"@ifc-lite/data": "^
|
|
18
|
+
"fflate": "^0.8.3",
|
|
19
|
+
"@ifc-lite/geometry": "^7.5.2",
|
|
20
|
+
"@ifc-lite/codegen": "^1.18.1",
|
|
21
|
+
"@ifc-lite/data": "^6.0.0",
|
|
22
22
|
"@ifc-lite/encoding": "^2.2.0",
|
|
23
|
-
"@ifc-lite/parser": "^
|
|
24
|
-
"@ifc-lite/
|
|
25
|
-
"@ifc-lite/
|
|
23
|
+
"@ifc-lite/parser": "^9.0.0",
|
|
24
|
+
"@ifc-lite/mutations": "^2.8.0",
|
|
25
|
+
"@ifc-lite/ifcx": "^4.2.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"jszip": "^3.10.2",
|
|
28
29
|
"typescript": "^6.0.3",
|
|
29
30
|
"vitest": "^5.0.1"
|
|
30
31
|
},
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Partial-redundancy bookkeeping for IFCRELAGGREGATES during a merge.
|
|
3
|
-
*
|
|
4
|
-
* Split out of {@link ../merged-exporter.ts} (kept under its module-size
|
|
5
|
-
* budget) rather than duplicated: `findEntitiesByType`/`extractStepAttribute`
|
|
6
|
-
* stay the single source of truth in `MergedExporter` and are passed in here,
|
|
7
|
-
* so this file has no data-model logic of its own to drift from it.
|
|
8
|
-
*/
|
|
9
|
-
import type { IfcDataStore } from '@ifc-lite/parser';
|
|
10
|
-
/**
|
|
11
|
-
* Skip IfcRelAggregates that become fully redundant after spatial
|
|
12
|
-
* unification, and mark the individually-redundant members of ones only
|
|
13
|
-
* PARTIALLY so for stripping.
|
|
14
|
-
*
|
|
15
|
-
* When Model2's `IfcRelAggregates(Project, (Site))` gets remapped to
|
|
16
|
-
* `IfcRelAggregates(FirstProject, (FirstSite))`, it duplicates Model1's
|
|
17
|
-
* existing relationship, causing viewers to show Site multiple times.
|
|
18
|
-
*
|
|
19
|
-
* An IfcRelAggregates is fully redundant (skipped entirely) when its
|
|
20
|
-
* RelatingObject (attr 4) AND ALL its RelatedObjects (attr 5) remap to an
|
|
21
|
-
* edge the primary model already declares. When only the RelatingObject and
|
|
22
|
-
* SOME (not all) of its RelatedObjects have such a primary edge — e.g. Model2's Building
|
|
23
|
-
* unifies with Model1's, and one of its two Storeys matches Model1's by
|
|
24
|
-
* name while the other is new — the rel is genuinely needed for its new
|
|
25
|
-
* member(s), but Model1's own relationship already lists the remapped
|
|
26
|
-
* one(s) under the same (now-shared) RelatingObject: emitting them again
|
|
27
|
-
* here would duplicate that membership. Those specific ids are recorded in
|
|
28
|
-
* `relAggregateStrip` so {@link applyRelAggregateStrip} drops them from the
|
|
29
|
-
* emitted RelatedObjects list, keeping only the genuinely new members.
|
|
30
|
-
*/
|
|
31
|
-
export declare function skipRedundantRelAggregates(dataStore: IfcDataStore, sharedRemap: Map<number, number>, skipEntityIds: Set<number>, relAggregateStrip: Map<number, Set<number>>, primaryAggregatePairs: ReadonlySet<string>, findEntitiesByType: (dataStore: IfcDataStore, typeUpper: string) => number[], extractStepAttribute: (expressId: number, dataStore: IfcDataStore, attrIndex: number) => string | null): void;
|
|
32
|
-
/** Encode one `RelatingObject → RelatedObject` aggregation edge for set lookup. */
|
|
33
|
-
export declare function aggregatePairKey(relatingObjectId: number, relatedObjectId: number): string;
|
|
34
|
-
/**
|
|
35
|
-
* Collect the aggregation edges actually declared by the primary model.
|
|
36
|
-
*
|
|
37
|
-
* A later model may unify both endpoint entities without the primary model
|
|
38
|
-
* declaring their relationship. Callers use this set to distinguish a truly
|
|
39
|
-
* duplicate edge from the only surviving statement of parentage.
|
|
40
|
-
*/
|
|
41
|
-
export declare function collectRelAggregatePairs(dataStore: IfcDataStore, findEntitiesByType: (dataStore: IfcDataStore, typeUpper: string) => number[], extractStepAttribute: (expressId: number, dataStore: IfcDataStore, attrIndex: number) => string | null, idOffset: number): Set<string>;
|
|
42
|
-
/**
|
|
43
|
-
* Render-time counterpart of {@link skipRedundantRelAggregates}: drop
|
|
44
|
-
* RelatedObjects members a partially redundant IFCRELAGGREGATES already
|
|
45
|
-
* shares with the first model's OWN relationship to the same (now-unified)
|
|
46
|
-
* RelatingObject. Reuses the same list/scalar-aware ref filter the
|
|
47
|
-
* `visibleOnly`/deletion dangling-ref path uses. Must run in LOCAL id
|
|
48
|
-
* space, before any id offset/remap — `localId` and the ids inside
|
|
49
|
-
* `relAggregateStrip` are both local to the model being rendered.
|
|
50
|
-
*
|
|
51
|
-
* Returns `entityText` unchanged when `localId` has no strip entry, and
|
|
52
|
-
* `null` when the filter would withhold the whole line — a strip set built
|
|
53
|
-
* by {@link skipRedundantRelAggregates} is a strict subset of the
|
|
54
|
-
* RelatedObjects list, so for well-formed input the filter only narrows,
|
|
55
|
-
* but a degenerate file (a stripped member id that also appears as a
|
|
56
|
-
* single-valued ref, e.g. self-aggregation) can null the line. The caller
|
|
57
|
-
* must withhold it, like every other user of the filter: every edge the
|
|
58
|
-
* line declared is already declared by the primary model, and emitting the
|
|
59
|
-
* unfiltered bytes instead would reintroduce the duplicate membership this
|
|
60
|
-
* module exists to remove.
|
|
61
|
-
*/
|
|
62
|
-
export declare function applyRelAggregateStrip(entityText: string, localId: number, relAggregateStrip: ReadonlyMap<number, ReadonlySet<number>>): string | null;
|
|
63
|
-
//# sourceMappingURL=merged-rel-aggregates.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merged-rel-aggregates.d.ts","sourceRoot":"","sources":["../src/merged-rel-aggregates.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,YAAY,EACvB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,EAC1B,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,EAC3C,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1C,kBAAkB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,EAAE,EAC5E,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,GACrG,IAAI,CAoCN;AAED,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAE1F;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,YAAY,EACvB,kBAAkB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,EAAE,EAC5E,oBAAoB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,EACtG,QAAQ,EAAE,MAAM,GACf,GAAG,CAAC,MAAM,CAAC,CAgBb;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,GAC1D,MAAM,GAAG,IAAI,CAIf"}
|
|
@@ -1,122 +0,0 @@
|
|
|
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 { filterHiddenRefsFromRelationshipLine } from './reference-collector.js';
|
|
5
|
-
/**
|
|
6
|
-
* Skip IfcRelAggregates that become fully redundant after spatial
|
|
7
|
-
* unification, and mark the individually-redundant members of ones only
|
|
8
|
-
* PARTIALLY so for stripping.
|
|
9
|
-
*
|
|
10
|
-
* When Model2's `IfcRelAggregates(Project, (Site))` gets remapped to
|
|
11
|
-
* `IfcRelAggregates(FirstProject, (FirstSite))`, it duplicates Model1's
|
|
12
|
-
* existing relationship, causing viewers to show Site multiple times.
|
|
13
|
-
*
|
|
14
|
-
* An IfcRelAggregates is fully redundant (skipped entirely) when its
|
|
15
|
-
* RelatingObject (attr 4) AND ALL its RelatedObjects (attr 5) remap to an
|
|
16
|
-
* edge the primary model already declares. When only the RelatingObject and
|
|
17
|
-
* SOME (not all) of its RelatedObjects have such a primary edge — e.g. Model2's Building
|
|
18
|
-
* unifies with Model1's, and one of its two Storeys matches Model1's by
|
|
19
|
-
* name while the other is new — the rel is genuinely needed for its new
|
|
20
|
-
* member(s), but Model1's own relationship already lists the remapped
|
|
21
|
-
* one(s) under the same (now-shared) RelatingObject: emitting them again
|
|
22
|
-
* here would duplicate that membership. Those specific ids are recorded in
|
|
23
|
-
* `relAggregateStrip` so {@link applyRelAggregateStrip} drops them from the
|
|
24
|
-
* emitted RelatedObjects list, keeping only the genuinely new members.
|
|
25
|
-
*/
|
|
26
|
-
export function skipRedundantRelAggregates(dataStore, sharedRemap, skipEntityIds, relAggregateStrip, primaryAggregatePairs, findEntitiesByType, extractStepAttribute) {
|
|
27
|
-
for (const relId of findEntitiesByType(dataStore, 'IFCRELAGGREGATES')) {
|
|
28
|
-
// RelatingObject is attr 4 — single #ref
|
|
29
|
-
const relatingAttr = extractStepAttribute(relId, dataStore, 4);
|
|
30
|
-
if (!relatingAttr)
|
|
31
|
-
continue;
|
|
32
|
-
const relatingRef = relatingAttr.match(/^#(\d+)$/);
|
|
33
|
-
if (!relatingRef || !sharedRemap.has(parseInt(relatingRef[1], 10)))
|
|
34
|
-
continue;
|
|
35
|
-
// RelatedObjects is attr 5 — list of #refs like (#2,#3)
|
|
36
|
-
const relatedAttr = extractStepAttribute(relId, dataStore, 5);
|
|
37
|
-
if (!relatedAttr)
|
|
38
|
-
continue;
|
|
39
|
-
const refs = [];
|
|
40
|
-
const refRegex = /#(\d+)/g;
|
|
41
|
-
let m;
|
|
42
|
-
while ((m = refRegex.exec(relatedAttr)) !== null) {
|
|
43
|
-
refs.push(parseInt(m[1], 10));
|
|
44
|
-
}
|
|
45
|
-
if (refs.length === 0)
|
|
46
|
-
continue;
|
|
47
|
-
const remappedRelatingObject = sharedRemap.get(parseInt(relatingRef[1], 10));
|
|
48
|
-
// An object identity match alone does not prove that the primary model
|
|
49
|
-
// already owns this aggregation edge. Preserve a matched member when this
|
|
50
|
-
// is the only relationship that establishes its parentage (#3550).
|
|
51
|
-
const redundantRefs = refs.filter(ref => {
|
|
52
|
-
const remappedRef = sharedRemap.get(ref);
|
|
53
|
-
return remappedRef !== undefined && primaryAggregatePairs.has(aggregatePairKey(remappedRelatingObject, remappedRef));
|
|
54
|
-
});
|
|
55
|
-
if (redundantRefs.length === refs.length) {
|
|
56
|
-
// Every edge already exists in the primary model — this rel is fully redundant.
|
|
57
|
-
skipEntityIds.add(relId);
|
|
58
|
-
}
|
|
59
|
-
else if (redundantRefs.length > 0) {
|
|
60
|
-
// Some, not all — keep the rel for its new member(s), but drop the
|
|
61
|
-
// ones Model1's own relationship already aggregates.
|
|
62
|
-
relAggregateStrip.set(relId, new Set(redundantRefs));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/** Encode one `RelatingObject → RelatedObject` aggregation edge for set lookup. */
|
|
67
|
-
export function aggregatePairKey(relatingObjectId, relatedObjectId) {
|
|
68
|
-
return `${relatingObjectId}:${relatedObjectId}`;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Collect the aggregation edges actually declared by the primary model.
|
|
72
|
-
*
|
|
73
|
-
* A later model may unify both endpoint entities without the primary model
|
|
74
|
-
* declaring their relationship. Callers use this set to distinguish a truly
|
|
75
|
-
* duplicate edge from the only surviving statement of parentage.
|
|
76
|
-
*/
|
|
77
|
-
export function collectRelAggregatePairs(dataStore, findEntitiesByType, extractStepAttribute, idOffset) {
|
|
78
|
-
const pairs = new Set();
|
|
79
|
-
for (const relId of findEntitiesByType(dataStore, 'IFCRELAGGREGATES')) {
|
|
80
|
-
const relatingAttr = extractStepAttribute(relId, dataStore, 4);
|
|
81
|
-
const relatingRef = relatingAttr?.match(/^#(\d+)$/);
|
|
82
|
-
if (!relatingRef)
|
|
83
|
-
continue;
|
|
84
|
-
const relatedAttr = extractStepAttribute(relId, dataStore, 5);
|
|
85
|
-
if (!relatedAttr)
|
|
86
|
-
continue;
|
|
87
|
-
const relatingId = parseInt(relatingRef[1], 10) + idOffset;
|
|
88
|
-
const refRegex = /#(\d+)/g;
|
|
89
|
-
let match;
|
|
90
|
-
while ((match = refRegex.exec(relatedAttr)) !== null) {
|
|
91
|
-
pairs.add(aggregatePairKey(relatingId, parseInt(match[1], 10) + idOffset));
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return pairs;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Render-time counterpart of {@link skipRedundantRelAggregates}: drop
|
|
98
|
-
* RelatedObjects members a partially redundant IFCRELAGGREGATES already
|
|
99
|
-
* shares with the first model's OWN relationship to the same (now-unified)
|
|
100
|
-
* RelatingObject. Reuses the same list/scalar-aware ref filter the
|
|
101
|
-
* `visibleOnly`/deletion dangling-ref path uses. Must run in LOCAL id
|
|
102
|
-
* space, before any id offset/remap — `localId` and the ids inside
|
|
103
|
-
* `relAggregateStrip` are both local to the model being rendered.
|
|
104
|
-
*
|
|
105
|
-
* Returns `entityText` unchanged when `localId` has no strip entry, and
|
|
106
|
-
* `null` when the filter would withhold the whole line — a strip set built
|
|
107
|
-
* by {@link skipRedundantRelAggregates} is a strict subset of the
|
|
108
|
-
* RelatedObjects list, so for well-formed input the filter only narrows,
|
|
109
|
-
* but a degenerate file (a stripped member id that also appears as a
|
|
110
|
-
* single-valued ref, e.g. self-aggregation) can null the line. The caller
|
|
111
|
-
* must withhold it, like every other user of the filter: every edge the
|
|
112
|
-
* line declared is already declared by the primary model, and emitting the
|
|
113
|
-
* unfiltered bytes instead would reintroduce the duplicate membership this
|
|
114
|
-
* module exists to remove.
|
|
115
|
-
*/
|
|
116
|
-
export function applyRelAggregateStrip(entityText, localId, relAggregateStrip) {
|
|
117
|
-
const toStrip = relAggregateStrip.get(localId);
|
|
118
|
-
if (toStrip === undefined)
|
|
119
|
-
return entityText;
|
|
120
|
-
return filterHiddenRefsFromRelationshipLine(entityText, id => toStrip.has(id));
|
|
121
|
-
}
|
|
122
|
-
//# sourceMappingURL=merged-rel-aggregates.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merged-rel-aggregates.js","sourceRoot":"","sources":["../src/merged-rel-aggregates.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAY/D,OAAO,EAAE,oCAAoC,EAAE,MAAM,0BAA0B,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,0BAA0B,CACxC,SAAuB,EACvB,WAAgC,EAChC,aAA0B,EAC1B,iBAA2C,EAC3C,qBAA0C,EAC1C,kBA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