@ifc-lite/create 2.1.2 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -170,4 +170,61 @@ export function ifcElementHeader(ownerHistoryId, placementId, productShapeId, pa
170
170
  params.Tag ?? null,
171
171
  ];
172
172
  }
173
+ /** Guards a caller's 0..255 or out-of-range channel from reaching STEP. */
174
+ function clamp01(v) {
175
+ return Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : 0;
176
+ }
177
+ /**
178
+ * Transparency is `1 - alpha`, and binary floating point turns an alpha of 0.9
179
+ * into `0.09999999999999998` in the STEP text. Four decimals is what
180
+ * `@ifc-lite/export`'s demesh writer settles on for the same value.
181
+ */
182
+ const TRANSPARENCY_DECIMALS = 4;
183
+ function roundTo(v, decimals) {
184
+ const factor = 10 ** decimals;
185
+ return Math.round(v * factor) / factor;
186
+ }
187
+ /**
188
+ * Emit `IfcColourRgb` -> `IfcSurfaceStyleShading` -> `IfcSurfaceStyle`.
189
+ *
190
+ * Returns the `IfcSurfaceStyle`, the id an `IfcStyledItem` should point at, and
191
+ * every entity in the chain. The first two differ on IFC2X3, which has no
192
+ * `IfcStyleAssignmentSelect`: there `IfcStyledItem.Styles` is a set of
193
+ * `IfcPresentationStyleAssignment`, the wrapper IFC4 deprecated and IFC4X3
194
+ * removed.
195
+ *
196
+ * `schemaVersion` is the schema the chain is built FOR. Callers that will
197
+ * export to a different schema than the model was parsed from have to pass the
198
+ * target, because this shape is not schema-neutral. IFC2X3 is the only version
199
+ * that needs the wrapper, so the test is for it by name and every later schema
200
+ * takes the default.
201
+ */
202
+ export function emitSurfaceStyle(editor, schemaVersion, color, name) {
203
+ const red = clamp01(color.red);
204
+ const green = clamp01(color.green);
205
+ const blue = clamp01(color.blue);
206
+ const alpha = clamp01(color.alpha ?? 1);
207
+ const colour = editor.addEntity('IfcColourRgb', [
208
+ null, { real: red }, { real: green }, { real: blue },
209
+ ]);
210
+ const shading = editor.addEntity('IfcSurfaceStyleShading', [
211
+ `#${colour.expressId}`,
212
+ { real: roundTo(1 - alpha, TRANSPARENCY_DECIMALS) },
213
+ ]);
214
+ const surfaceStyle = editor.addEntity('IfcSurfaceStyle', [
215
+ name ?? null,
216
+ '.BOTH.',
217
+ [`#${shading.expressId}`],
218
+ ]);
219
+ const chainIds = [colour.expressId, shading.expressId, surfaceStyle.expressId];
220
+ let styleRefId = surfaceStyle.expressId;
221
+ if (schemaVersion === 'IFC2X3') {
222
+ const assignment = editor.addEntity('IfcPresentationStyleAssignment', [[`#${surfaceStyle.expressId}`]]);
223
+ styleRefId = assignment.expressId;
224
+ chainIds.push(assignment.expressId);
225
+ }
226
+ // chainIds so a caller that later finds nothing referencing this style can
227
+ // take the whole chain back out rather than leaving it orphaned.
228
+ return { surfaceStyleId: surfaceStyle.expressId, styleRefId, chainIds };
229
+ }
173
230
  //# sourceMappingURL=_emit-helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_emit-helpers.js","sourceRoot":"","sources":["../../src/in-store/_emit-helpers.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,eAAe,EAAqB,MAAM,oBAAoB,CAAC;AAGxE,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAyB,EAAE,OAAe;IAC7E,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAmB,EACnB,iBAAyB,EACzB,QAAkC,EAClC,IAA+B,EAC/B,YAAuC;IAEvC,MAAM,QAAQ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AC,SAAS,EAAE,CAAC;KAC1B,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IAE/E,IAAI,UAAU,GAAG,YAAY,CAAC,SAAS,CAAC;IACxC,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CACjC,gCAAgC,EAAE,CAAC,CAAC,IAAI,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC,CACnE,CAAC;QACF,UAAU,GAAG,UAAU,CAAC,SAAS,CAAC;QAClC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,2EAA2E;IAC3E,iEAAiE;IACjE,OAAO,EAAE,cAAc,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Colour products by authoring real presentation-style entities into the store,
3
+ * so the colour survives export instead of living in a viewer overlay.
4
+ *
5
+ * `bim.viewer.colorize` paints the current view and is gone the moment the
6
+ * model is written out. Persisting the same colour meant hand-building the
7
+ * style chain and walking `IfcProductDefinitionShape -> IfcShapeRepresentation
8
+ * -> Items`, including the `IfcMappedItem` indirection, at every call site.
9
+ *
10
+ * Lives beside the other in-store builders so the backend layer can reach it
11
+ * without parser internals, the same arrangement as `resolve-source.ts`.
12
+ */
13
+ import { type IfcDataStore } from '@ifc-lite/parser';
14
+ import type { IfcAttributeValue, StoreEditor } from '@ifc-lite/mutations';
15
+ import { type SurfaceStyleColor } from './_emit-helpers.js';
16
+ export type { SurfaceStyleColor };
17
+ export interface StyleBatch {
18
+ /** Products to colour, by expressId. */
19
+ products: readonly number[];
20
+ /** Channels in 0..1. */
21
+ color: SurfaceStyleColor;
22
+ /** `IfcSurfaceStyle.Name`. Omitted writes `$`. */
23
+ name?: string;
24
+ }
25
+ export interface ApplyStyleOptions {
26
+ /**
27
+ * Replace a style the geometry already carries (default `true`). IFC allows
28
+ * at most one `IfcStyledItem` per representation item, so adding a second
29
+ * where one exists writes a schema-invalid file; the existing one is
30
+ * tombstoned instead. Pass `false` to leave already-styled geometry alone.
31
+ */
32
+ replaceExisting?: boolean;
33
+ /**
34
+ * Style the geometry a type's occurrences share, rather than each occurrence
35
+ * (default `true`).
36
+ *
37
+ * Following `IfcMappedItem` to the `IfcRepresentationMap` is what makes one
38
+ * style cover every occurrence of a type, which is what you want colouring by
39
+ * IFC class. It is wrong for any other grouping: colouring by system, storey
40
+ * or property value, the shared geometry takes the colour of whichever batch
41
+ * touched it last, and occurrences in other groups change with it. Pass
42
+ * `false` to style the `IfcMappedItem` itself, one per occurrence.
43
+ *
44
+ * Do not mix the two settings over one model. They style different entities
45
+ * — the mapped item and the geometry behind it — so `replaceExisting` cannot
46
+ * see the conflict, and an occurrence ends up carrying both a shared style
47
+ * and its own, with the winner left to the viewer.
48
+ */
49
+ followMappedItems?: boolean;
50
+ /**
51
+ * Schema the style chain is built for. Defaults to the store's own.
52
+ *
53
+ * `IfcStyledItem.Styles` holds `IfcPresentationStyleAssignment` on IFC2X3 and
54
+ * the `IfcSurfaceStyle` directly from IFC4 on, and this is decided when the
55
+ * style is authored, not when the file is written. Exporting to a different
56
+ * schema than the model was parsed from therefore needs the target passed in;
57
+ * otherwise the emitted records are invalid for the file they land in.
58
+ *
59
+ * Typed as the store's own schema union rather than a bare string: the two
60
+ * are halves of one decision, and a near-miss like `'IFC2x3'` would otherwise
61
+ * typecheck and silently emit the IFC4 shape. IFC2X3 is the only member that
62
+ * differs; IFC4, IFC4X3 and IFC5 all take the `IfcSurfaceStyle` directly,
63
+ * which is why the branch tests for IFC2X3 rather than listing the rest.
64
+ */
65
+ schema?: IfcDataStore['schemaVersion'];
66
+ }
67
+ /**
68
+ * What one batch did.
69
+ *
70
+ * A snapshot taken when the call returns, not a live view. Results from a
71
+ * single `applyStylesInStore` are reconciled against each other before they are
72
+ * handed back, so a batch whose work a later batch replaced reports that. A
73
+ * result from an *earlier* call cannot be: recolouring the same geometry in a
74
+ * second call removes the styled items the first call named, and that first
75
+ * result still names them. The file is correct either way; only the older
76
+ * return value goes stale.
77
+ */
78
+ export interface ApplyStyleResult {
79
+ /**
80
+ * The `IfcSurfaceStyle` every item styled by this batch now points at, or
81
+ * `null` when the batch styled nothing.
82
+ *
83
+ * Null rather than an id because the style is only authored once there is
84
+ * something to attach it to. Emitting it up front left an orphan colour chain
85
+ * in the file for every batch that reached no geometry — and a caller
86
+ * colouring by IFC class hands in a batch per class, most of which (types,
87
+ * ports, spatial structure) have none.
88
+ */
89
+ surfaceStyleId: number | null;
90
+ /** One `IfcStyledItem` per representation item that was styled. */
91
+ styledItemIds: number[];
92
+ /** Products that reached no geometry: no representation, or an empty one. */
93
+ productsWithoutGeometry: number[];
94
+ /**
95
+ * Pre-existing `IfcStyledItem` entities tombstoned to make room.
96
+ *
97
+ * Only the styled item is removed. The `IfcSurfaceStyle` it pointed at stays
98
+ * in the file, detached: a style can be shared with styled items this call
99
+ * never touched, so removing it is not safe in general, and an unreferenced
100
+ * style definition is valid IFC.
101
+ *
102
+ * Empty whenever `replaceExisting` is `false`, which is when
103
+ * `keptExistingItemIds` is the field carrying the answer.
104
+ */
105
+ replacedStyledItemIds: number[];
106
+ /**
107
+ * Representation items left alone because they already carried a style and
108
+ * `replaceExisting` was `false`. Empty otherwise.
109
+ */
110
+ keptExistingItemIds: number[];
111
+ }
112
+ interface RawEntity {
113
+ type: string;
114
+ attributes: IfcAttributeValue[];
115
+ }
116
+ /**
117
+ * The geometry a product is drawn from.
118
+ *
119
+ * With `followMappedItems` (the default), an `IfcMappedItem` resolves to the
120
+ * items of the `IfcRepresentationMap` behind it, so the geometry every
121
+ * occurrence of a type shares is what comes back. Without it, the mapped item
122
+ * itself is the leaf. See `ApplyStyleOptions.followMappedItems` for which one
123
+ * you want.
124
+ *
125
+ * Exported because three private copies of this walk already exist in
126
+ * `extract-walls.ts` and one in `@ifc-lite/export`'s LOD generator, and none of
127
+ * them follows mapped items. This is the complete one.
128
+ */
129
+ export declare function collectLeafRepresentationItems(read: (id: number) => RawEntity | null, representationId: number, options?: {
130
+ followMappedItems?: boolean;
131
+ }): Set<number>;
132
+ /**
133
+ * Give every representation item behind each batch's products one
134
+ * `IfcSurfaceStyle`.
135
+ *
136
+ * Batches are applied in order, and a later batch wins where two of them reach
137
+ * the same geometry. Writes through the `StoreEditor` overlay, so nothing
138
+ * touches the source buffer and `StepExporter` picks the new entities up on
139
+ * export.
140
+ */
141
+ export declare function applyStylesInStore(editor: StoreEditor, store: IfcDataStore, batches: readonly StyleBatch[], options?: ApplyStyleOptions): ApplyStyleResult[];
142
+ //# sourceMappingURL=apply-style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-style.d.ts","sourceRoot":"","sources":["../../src/in-store/apply-style.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAmD,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtG,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE9E,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC,MAAM,WAAW,UAAU;IACzB,wCAAwC;IACxC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,wBAAwB;IACxB,KAAK,EAAE,iBAAiB,CAAC;IACzB,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC;CACxC;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;OASG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,mEAAmE;IACnE,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,6EAA6E;IAC7E,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAClC;;;;;;;;;;OAUG;IACH,qBAAqB,EAAE,MAAM,EAAE,CAAC;IAChC;;;OAGG;IACH,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,iBAAiB,EAAE,CAAC;CACjC;AA0DD;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,SAAS,GAAG,IAAI,EACtC,gBAAgB,EAAE,MAAM,EACxB,OAAO,GAAE;IAAE,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAAO,GAC5C,GAAG,CAAC,MAAM,CAAC,CA8Bb;AAsDD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,OAAO,GAAE,iBAAsB,GAC9B,gBAAgB,EAAE,CA+FpB"}
@@ -0,0 +1,309 @@
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
+ * Colour products by authoring real presentation-style entities into the store,
6
+ * so the colour survives export instead of living in a viewer overlay.
7
+ *
8
+ * `bim.viewer.colorize` paints the current view and is gone the moment the
9
+ * model is written out. Persisting the same colour meant hand-building the
10
+ * style chain and walking `IfcProductDefinitionShape -> IfcShapeRepresentation
11
+ * -> Items`, including the `IfcMappedItem` indirection, at every call site.
12
+ *
13
+ * Lives beside the other in-store builders so the backend layer can reach it
14
+ * without parser internals, the same arrangement as `resolve-source.ts`.
15
+ */
16
+ import { EntityExtractor, getAttributeNamesAcrossSchemas } from '@ifc-lite/parser';
17
+ import { emitSurfaceStyle } from './_emit-helpers.js';
18
+ /**
19
+ * A STEP reference as an expressId.
20
+ *
21
+ * Source-parsed entities carry refs as numbers; overlay-created ones carry the
22
+ * `'#123'` strings `StoreEditor.addEntity` takes. Both reach this module, so
23
+ * both forms have to resolve.
24
+ */
25
+ function asRef(value) {
26
+ if (typeof value === 'number')
27
+ return value;
28
+ if (typeof value === 'string' && value.startsWith('#')) {
29
+ const id = Number(value.slice(1));
30
+ return Number.isInteger(id) ? id : null;
31
+ }
32
+ return null;
33
+ }
34
+ function refList(value) {
35
+ if (!Array.isArray(value))
36
+ return [];
37
+ const out = [];
38
+ for (const item of value) {
39
+ const id = asRef(item);
40
+ if (id !== null)
41
+ out.push(id);
42
+ }
43
+ return out;
44
+ }
45
+ /**
46
+ * Depth limit for the representation walk. Real nesting is three levels (shape
47
+ * -> representation -> item, plus one hop through a mapped representation);
48
+ * this only has to stop a malformed file from looping.
49
+ */
50
+ const MAX_REPRESENTATION_DEPTH = 8;
51
+ /** Attribute indices that are fixed across every schema for these classes. */
52
+ const SHAPE_REPRESENTATIONS_INDEX = 2; // IfcProductDefinitionShape.Representations
53
+ const REPRESENTATION_ITEMS_INDEX = 3; // IfcShapeRepresentation.Items
54
+ const MAPPED_ITEM_SOURCE_INDEX = 0; // IfcMappedItem.MappingSource
55
+ const MAPPED_REPRESENTATION_INDEX = 1; // IfcRepresentationMap.MappedRepresentation
56
+ const STYLED_ITEM_TARGET_INDEX = 0; // IfcStyledItem.Item
57
+ /**
58
+ * Index of a named attribute on a class, resolved against the bundled schema
59
+ * union rather than hardcoded.
60
+ *
61
+ * `Representation` is index 6 on `IfcProduct` but the same slot is
62
+ * `RepresentationMaps` on `IfcTypeProduct` — a list, not a single ref. Reading
63
+ * a constant 6 turns a type object handed in by a caller into a silent no-op
64
+ * instead of an honest "no geometry". Same reasoning as `findAttrIndex` in
65
+ * `@ifc-lite/export`'s demesh writer (#2032).
66
+ */
67
+ function attributeIndex(typeName, attrName) {
68
+ const names = getAttributeNamesAcrossSchemas(typeName);
69
+ const idx = names.indexOf(attrName);
70
+ return idx >= 0 ? idx : null;
71
+ }
72
+ /**
73
+ * The geometry a product is drawn from.
74
+ *
75
+ * With `followMappedItems` (the default), an `IfcMappedItem` resolves to the
76
+ * items of the `IfcRepresentationMap` behind it, so the geometry every
77
+ * occurrence of a type shares is what comes back. Without it, the mapped item
78
+ * itself is the leaf. See `ApplyStyleOptions.followMappedItems` for which one
79
+ * you want.
80
+ *
81
+ * Exported because three private copies of this walk already exist in
82
+ * `extract-walls.ts` and one in `@ifc-lite/export`'s LOD generator, and none of
83
+ * them follows mapped items. This is the complete one.
84
+ */
85
+ export function collectLeafRepresentationItems(read, representationId, options = {}) {
86
+ const followMapped = options.followMappedItems ?? true;
87
+ const out = new Set();
88
+ const walk = (id, depth) => {
89
+ if (depth > MAX_REPRESENTATION_DEPTH)
90
+ return;
91
+ const entity = read(id);
92
+ if (!entity)
93
+ return;
94
+ const type = entity.type.toUpperCase();
95
+ if (type === 'IFCPRODUCTDEFINITIONSHAPE') {
96
+ for (const rep of refList(entity.attributes[SHAPE_REPRESENTATIONS_INDEX]))
97
+ walk(rep, depth + 1);
98
+ return;
99
+ }
100
+ if (type === 'IFCSHAPEREPRESENTATION') {
101
+ for (const item of refList(entity.attributes[REPRESENTATION_ITEMS_INDEX]))
102
+ walk(item, depth + 1);
103
+ return;
104
+ }
105
+ if (type === 'IFCMAPPEDITEM' && followMapped) {
106
+ const source = asRef(entity.attributes[MAPPED_ITEM_SOURCE_INDEX]);
107
+ if (source === null)
108
+ return;
109
+ const mapped = asRef(read(source)?.attributes[MAPPED_REPRESENTATION_INDEX]);
110
+ if (mapped !== null)
111
+ walk(mapped, depth + 1);
112
+ return;
113
+ }
114
+ out.add(id);
115
+ };
116
+ walk(representationId, 0);
117
+ return out;
118
+ }
119
+ /**
120
+ * Read an entity by expressId, source buffer first and overlay second.
121
+ *
122
+ * `StoreEditor.addEntity` does not insert into `store.entityIndex`, so a
123
+ * source-only reader cannot see anything created in the same session: styling a
124
+ * wall from `bim.store.addWall` reported it as geometry-less and wrote an
125
+ * orphan style. Mirrors `readEntity` in `extract-walls.ts`.
126
+ */
127
+ function createReader(store, editor) {
128
+ const extractor = new EntityExtractor(store.source);
129
+ return (id) => {
130
+ const ref = store.entityIndex.byId.get(id);
131
+ if (ref && ref.byteLength > 0 && ref.byteOffset >= 0) {
132
+ const entity = extractor.extractEntity(ref);
133
+ if (entity)
134
+ return { type: entity.type, attributes: entity.attributes ?? [] };
135
+ }
136
+ const created = editor.getNewEntity(id);
137
+ return created ? { type: created.type, attributes: created.attributes ?? [] } : null;
138
+ };
139
+ }
140
+ /**
141
+ * Every representation item that already carries an `IfcStyledItem`, keyed by
142
+ * the item it styles.
143
+ *
144
+ * Built once per call and then maintained as styled items are added and
145
+ * removed. Rebuilding it per batch was both the dominant cost of a
146
+ * colour-by-class pass (87 ms per batch on a 92k-styled-item model) and a
147
+ * correctness gap: a second batch could not see the first batch's styled items,
148
+ * so overlapping geometry ended up with two of them.
149
+ */
150
+ function indexExistingStyles(store, editor, read) {
151
+ const styledBy = new Map();
152
+ for (const id of store.entityIndex.byType.get('IFCSTYLEDITEM') ?? []) {
153
+ const target = asRef(read(id)?.attributes[STYLED_ITEM_TARGET_INDEX]);
154
+ if (target !== null)
155
+ styledBy.set(target, id);
156
+ }
157
+ for (const created of editor.getNewEntities()) {
158
+ if (created.type.toUpperCase() !== 'IFCSTYLEDITEM')
159
+ continue;
160
+ const target = asRef(created.attributes?.[STYLED_ITEM_TARGET_INDEX]);
161
+ if (target !== null)
162
+ styledBy.set(target, created.expressId);
163
+ }
164
+ return styledBy;
165
+ }
166
+ /**
167
+ * Give every representation item behind each batch's products one
168
+ * `IfcSurfaceStyle`.
169
+ *
170
+ * Batches are applied in order, and a later batch wins where two of them reach
171
+ * the same geometry. Writes through the `StoreEditor` overlay, so nothing
172
+ * touches the source buffer and `StepExporter` picks the new entities up on
173
+ * export.
174
+ */
175
+ export function applyStylesInStore(editor, store, batches, options = {}) {
176
+ const replaceExisting = options.replaceExisting ?? true;
177
+ const followMapped = options.followMappedItems ?? true;
178
+ const schema = options.schema ?? store.schemaVersion;
179
+ const read = createReader(store, editor);
180
+ const styledBy = indexExistingStyles(store, editor, read);
181
+ const results = batches.map(batch => {
182
+ const items = new Set();
183
+ const productsWithoutGeometry = [];
184
+ for (const product of batch.products) {
185
+ // Per product, then merged. Asking whether the shared set grew would call
186
+ // every occurrence after the first "geometry-less" whenever a type's
187
+ // occurrences share one mapped representation — which is most of them.
188
+ const entity = read(product);
189
+ const repIndex = entity ? attributeIndex(entity.type, 'Representation') : null;
190
+ const representation = repIndex === null
191
+ ? null
192
+ : asRef(entity?.attributes[repIndex]);
193
+ const reached = representation === null
194
+ ? new Set()
195
+ : collectLeafRepresentationItems(read, representation, { followMappedItems: followMapped });
196
+ if (reached.size === 0) {
197
+ productsWithoutGeometry.push(product);
198
+ continue;
199
+ }
200
+ for (const item of reached)
201
+ items.add(item);
202
+ }
203
+ // Split before emitting anything, so a batch that turns out to style
204
+ // nothing does not leave a colour chain behind.
205
+ const keptExistingItemIds = [];
206
+ const toStyle = [];
207
+ for (const item of [...items].sort((a, b) => a - b)) {
208
+ if (!replaceExisting && styledBy.has(item))
209
+ keptExistingItemIds.push(item);
210
+ else
211
+ toStyle.push(item);
212
+ }
213
+ if (toStyle.length === 0) {
214
+ return {
215
+ surfaceStyleId: null,
216
+ styledItemIds: [],
217
+ productsWithoutGeometry,
218
+ replacedStyledItemIds: [],
219
+ keptExistingItemIds,
220
+ };
221
+ }
222
+ const style = emitSurfaceStyle(editor, schema, batch.color, batch.name);
223
+ const styleRef = `#${style.styleRefId}`;
224
+ const chain = {
225
+ styleId: style.surfaceStyleId, chainIds: style.chainIds, styledItemIds: [],
226
+ };
227
+ authoredChains.set(editor, [...(authoredChains.get(editor) ?? []), chain]);
228
+ const styledItemIds = [];
229
+ const replacedStyledItemIds = [];
230
+ for (const item of toStyle) {
231
+ const existing = styledBy.get(item);
232
+ if (existing !== undefined) {
233
+ editor.removeEntity(existing);
234
+ replacedStyledItemIds.push(existing);
235
+ }
236
+ const styled = editor.addEntity('IfcStyledItem', [`#${item}`, [styleRef], null]);
237
+ styledBy.set(item, styled.expressId);
238
+ styledItemIds.push(styled.expressId);
239
+ chain.styledItemIds.push(styled.expressId);
240
+ }
241
+ return {
242
+ surfaceStyleId: style.surfaceStyleId,
243
+ styledItemIds,
244
+ productsWithoutGeometry,
245
+ replacedStyledItemIds,
246
+ keptExistingItemIds,
247
+ };
248
+ });
249
+ sweepAuthoredChains(editor);
250
+ // A styled item can be replaced after its batch returned — by a later batch,
251
+ // or by a later call entirely. Report what is actually still in the file.
252
+ const live = new Set(editor.getNewEntities().map(e => e.expressId));
253
+ return results.map(result => {
254
+ const surviving = result.styledItemIds.filter(id => live.has(id));
255
+ if (surviving.length === result.styledItemIds.length)
256
+ return result;
257
+ return {
258
+ ...result,
259
+ styledItemIds: surviving,
260
+ surfaceStyleId: surviving.length === 0 ? null : result.surfaceStyleId,
261
+ };
262
+ });
263
+ }
264
+ /**
265
+ * Style chains this module authored, per editor, and the styled items each was
266
+ * created for.
267
+ *
268
+ * Kept rather than inferred. Deciding "is this style garbage" by reading the
269
+ * overlay was wrong three ways: it could not see `setPositionalAttribute` edits
270
+ * (`getNewEntities` returns creation-time attributes, while the exporter
271
+ * applies positional mutations on top), so it deleted live styles and kept dead
272
+ * ones; it removed a chain's shading and colour without checking whether
273
+ * another style still used them; and it collected any overlay `IfcSurfaceStyle`
274
+ * at all, including chains a caller had authored with `bim.store.addEntity` and
275
+ * not yet attached. All three needed a caller using `bim.store.*` alongside
276
+ * `bim.style`, which is public API.
277
+ *
278
+ * A `WeakMap` because it has to outlive one call — recolouring in a second
279
+ * `apply` is exactly the case per-call bookkeeping could not reach — without
280
+ * keeping a finished editor alive.
281
+ */
282
+ const authoredChains = new WeakMap();
283
+ /**
284
+ * Drop the chains whose every styled item is gone.
285
+ *
286
+ * Liveness is membership in the overlay: removing an overlay-created entity
287
+ * deletes it from `newEntities`, so `getNewEntity` answering null is the whole
288
+ * test. Nothing here reads an attribute, which is what makes it immune to a
289
+ * caller repointing one of these styled items — that leaves the chain looking
290
+ * referenced, so it survives. Keeping a chain that turned out to be garbage is
291
+ * the safe direction; removing one still pointed at writes a dangling
292
+ * reference into the file.
293
+ */
294
+ function sweepAuthoredChains(editor) {
295
+ const chains = authoredChains.get(editor);
296
+ if (!chains || chains.length === 0)
297
+ return;
298
+ const surviving = [];
299
+ for (const chain of chains) {
300
+ if (chain.styledItemIds.some(id => editor.getNewEntity(id) !== null)) {
301
+ surviving.push(chain);
302
+ continue;
303
+ }
304
+ for (const id of chain.chainIds)
305
+ editor.removeEntity(id);
306
+ }
307
+ authoredChains.set(editor, surviving);
308
+ }
309
+ //# sourceMappingURL=apply-style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-style.js","sourceRoot":"","sources":["../../src/in-store/apply-style.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,eAAe,EAAE,8BAA8B,EAAqB,MAAM,kBAAkB,CAAC;AAEtG,OAAO,EAAE,gBAAgB,EAA0B,MAAM,oBAAoB,CAAC;AA2G9E;;;;;;GAMG;AACH,SAAS,KAAK,CAAC,KAAoC;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACvD,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAA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