@ifc-lite/export 4.13.3 → 5.0.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/affected-set.d.ts.map +1 -1
- package/dist/affected-set.js +9 -2
- package/dist/affected-set.js.map +1 -1
- package/dist/anonymize-export.js +2 -2
- package/dist/anonymize-export.js.map +1 -1
- package/dist/anonymize-scrub.js +3 -3
- package/dist/anonymize-scrub.js.map +1 -1
- package/dist/appearance-dependencies.js +1 -1
- package/dist/appearance-dependencies.js.map +1 -1
- package/dist/attribute-real-slots.js +1 -1
- package/dist/attribute-real-slots.js.map +1 -1
- package/dist/attribute-slot-types.d.ts.map +1 -1
- package/dist/attribute-slot-types.js +22 -14
- package/dist/attribute-slot-types.js.map +1 -1
- package/dist/authored-resource-cleanup.js +1 -1
- package/dist/authored-resource-cleanup.js.map +1 -1
- package/dist/declared-property-type.d.ts.map +1 -1
- package/dist/declared-property-type.js +5 -4
- package/dist/declared-property-type.js.map +1 -1
- package/dist/edit-ownership.d.ts +8 -0
- package/dist/edit-ownership.d.ts.map +1 -1
- package/dist/edit-ownership.js +58 -44
- package/dist/edit-ownership.js.map +1 -1
- package/dist/effective-index-created-rows.d.ts +22 -0
- package/dist/effective-index-created-rows.d.ts.map +1 -0
- package/dist/effective-index-created-rows.js +48 -0
- package/dist/effective-index-created-rows.js.map +1 -0
- package/dist/effective-index.d.ts.map +1 -1
- package/dist/effective-index.js +4 -3
- package/dist/effective-index.js.map +1 -1
- package/dist/effective-source-record.js +1 -1
- package/dist/effective-source-record.js.map +1 -1
- package/dist/entity-subgraph.d.ts +6 -2
- package/dist/entity-subgraph.d.ts.map +1 -1
- package/dist/entity-subgraph.js +70 -5
- package/dist/entity-subgraph.js.map +1 -1
- package/dist/entity-type-sets.d.ts +2 -19
- package/dist/entity-type-sets.d.ts.map +1 -1
- package/dist/entity-type-sets.js +14 -4
- package/dist/entity-type-sets.js.map +1 -1
- package/dist/georef-closure.d.ts +12 -0
- package/dist/georef-closure.d.ts.map +1 -1
- package/dist/georef-closure.js +3 -1
- package/dist/georef-closure.js.map +1 -1
- package/dist/ifc4-registry.d.ts +14 -0
- package/dist/ifc4-registry.d.ts.map +1 -0
- package/dist/ifc4-registry.js +22 -0
- package/dist/ifc4-registry.js.map +1 -0
- package/dist/ifc5-effective-rows.js +1 -1
- package/dist/ifc5-effective-rows.js.map +1 -1
- package/dist/ifc5-exporter.d.ts.map +1 -1
- package/dist/ifc5-exporter.js +3 -10
- package/dist/ifc5-exporter.js.map +1 -1
- package/dist/ifc5-tree-scope.js +2 -2
- package/dist/ifc5-tree-scope.js.map +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/lod0-generator.d.ts.map +1 -1
- package/dist/lod0-generator.js +14 -8
- package/dist/lod0-generator.js.map +1 -1
- package/dist/merged-bake.d.ts +32 -0
- package/dist/merged-bake.d.ts.map +1 -0
- package/dist/merged-bake.js +120 -0
- package/dist/merged-bake.js.map +1 -0
- package/dist/merged-context.d.ts +49 -6
- package/dist/merged-context.d.ts.map +1 -1
- package/dist/merged-context.js +165 -53
- package/dist/merged-context.js.map +1 -1
- package/dist/merged-exporter.d.ts +7 -14
- package/dist/merged-exporter.d.ts.map +1 -1
- package/dist/merged-exporter.js +48 -113
- package/dist/merged-exporter.js.map +1 -1
- package/dist/merged-georef-normalize.d.ts +54 -0
- package/dist/merged-georef-normalize.d.ts.map +1 -0
- package/dist/merged-georef-normalize.js +260 -0
- package/dist/merged-georef-normalize.js.map +1 -0
- package/dist/merged-project-contexts.d.ts +12 -0
- package/dist/merged-project-contexts.d.ts.map +1 -0
- package/dist/merged-project-contexts.js +56 -0
- package/dist/merged-project-contexts.js.map +1 -0
- package/dist/merged-remap.d.ts +2 -0
- package/dist/merged-remap.d.ts.map +1 -1
- package/dist/merged-remap.js +10 -0
- package/dist/merged-remap.js.map +1 -1
- package/dist/merged-subcontext.d.ts +22 -0
- package/dist/merged-subcontext.d.ts.map +1 -1
- package/dist/merged-subcontext.js +14 -18
- package/dist/merged-subcontext.js.map +1 -1
- package/dist/nonrel-positional-ref-narrowing.js +6 -6
- package/dist/nonrel-positional-ref-narrowing.js.map +1 -1
- package/dist/nonrel-ref-list-types.d.ts +4 -4
- package/dist/nonrel-ref-list-types.d.ts.map +1 -1
- package/dist/nonrel-ref-list-types.js +19 -7
- package/dist/nonrel-ref-list-types.js.map +1 -1
- package/dist/parquet-created-entity-rows.js +1 -1
- package/dist/parquet-created-entity-rows.js.map +1 -1
- package/dist/parquet-relationship-rows.js +1 -1
- package/dist/parquet-relationship-rows.js.map +1 -1
- package/dist/reference-collector.d.ts.map +1 -1
- package/dist/reference-collector.js +2 -2
- package/dist/reference-collector.js.map +1 -1
- package/dist/registry-entity-names.d.ts +6 -2
- package/dist/registry-entity-names.d.ts.map +1 -1
- package/dist/registry-entity-names.js +10 -2
- package/dist/registry-entity-names.js.map +1 -1
- package/dist/relationship-slot-bounds.js +4 -4
- package/dist/relationship-slot-bounds.js.map +1 -1
- package/dist/remesh-context-roots.d.ts +13 -6
- package/dist/remesh-context-roots.d.ts.map +1 -1
- package/dist/remesh-context-roots.js +51 -22
- package/dist/remesh-context-roots.js.map +1 -1
- package/dist/renumber-step-ids.d.ts +43 -0
- package/dist/renumber-step-ids.d.ts.map +1 -0
- package/dist/renumber-step-ids.js +237 -0
- package/dist/renumber-step-ids.js.map +1 -0
- package/dist/retype.d.ts.map +1 -1
- package/dist/retype.js +23 -12
- package/dist/retype.js.map +1 -1
- package/dist/schema-conversion-description.d.ts +6 -0
- package/dist/schema-conversion-description.d.ts.map +1 -0
- package/dist/schema-conversion-description.js +25 -0
- package/dist/schema-conversion-description.js.map +1 -0
- package/dist/schema-conversion-loss-report.d.ts +20 -34
- package/dist/schema-conversion-loss-report.d.ts.map +1 -1
- package/dist/schema-conversion-loss-report.js +177 -14
- package/dist/schema-conversion-loss-report.js.map +1 -1
- package/dist/schema-converter-attr-maps.d.ts +51 -0
- package/dist/schema-converter-attr-maps.d.ts.map +1 -0
- package/dist/schema-converter-attr-maps.js +142 -0
- package/dist/schema-converter-attr-maps.js.map +1 -0
- package/dist/schema-converter-attr-remap.d.ts +8 -0
- package/dist/schema-converter-attr-remap.d.ts.map +1 -1
- package/dist/schema-converter-attr-remap.js +15 -1
- package/dist/schema-converter-attr-remap.js.map +1 -1
- package/dist/schema-converter-document-links.d.ts +23 -0
- package/dist/schema-converter-document-links.d.ts.map +1 -0
- package/dist/schema-converter-document-links.js +146 -0
- package/dist/schema-converter-document-links.js.map +1 -0
- package/dist/schema-converter-enums.d.ts +13 -1
- package/dist/schema-converter-enums.d.ts.map +1 -1
- package/dist/schema-converter-enums.js +30 -4
- package/dist/schema-converter-enums.js.map +1 -1
- package/dist/schema-converter-ifc4-slots.d.ts +4 -3
- package/dist/schema-converter-ifc4-slots.d.ts.map +1 -1
- package/dist/schema-converter-ifc4-slots.js +4 -3
- package/dist/schema-converter-ifc4-slots.js.map +1 -1
- package/dist/schema-converter-renames.d.ts +17 -0
- package/dist/schema-converter-renames.d.ts.map +1 -1
- package/dist/schema-converter-renames.js +34 -2
- package/dist/schema-converter-renames.js.map +1 -1
- package/dist/schema-converter-retyped.d.ts +17 -0
- package/dist/schema-converter-retyped.d.ts.map +1 -0
- package/dist/schema-converter-retyped.js +68 -0
- package/dist/schema-converter-retyped.js.map +1 -0
- package/dist/schema-converter-structural-axes.d.ts +55 -0
- package/dist/schema-converter-structural-axes.d.ts.map +1 -0
- package/dist/schema-converter-structural-axes.js +378 -0
- package/dist/schema-converter-structural-axes.js.map +1 -0
- package/dist/schema-converter-structural-carriers.d.ts +76 -0
- package/dist/schema-converter-structural-carriers.d.ts.map +1 -0
- package/dist/schema-converter-structural-carriers.js +330 -0
- package/dist/schema-converter-structural-carriers.js.map +1 -0
- package/dist/schema-converter-structural-diagnostics.d.ts +64 -0
- package/dist/schema-converter-structural-diagnostics.d.ts.map +1 -0
- package/dist/schema-converter-structural-diagnostics.js +219 -0
- package/dist/schema-converter-structural-diagnostics.js.map +1 -0
- package/dist/schema-converter-structural-links.d.ts +21 -0
- package/dist/schema-converter-structural-links.d.ts.map +1 -0
- package/dist/schema-converter-structural-links.js +38 -0
- package/dist/schema-converter-structural-links.js.map +1 -0
- package/dist/schema-converter-structural-source.d.ts +76 -0
- package/dist/schema-converter-structural-source.d.ts.map +1 -0
- package/dist/schema-converter-structural-source.js +197 -0
- package/dist/schema-converter-structural-source.js.map +1 -0
- package/dist/schema-converter-structural-thickness.d.ts +33 -0
- package/dist/schema-converter-structural-thickness.d.ts.map +1 -0
- package/dist/schema-converter-structural-thickness.js +155 -0
- package/dist/schema-converter-structural-thickness.js.map +1 -0
- package/dist/schema-converter-structural-varying.d.ts +50 -0
- package/dist/schema-converter-structural-varying.d.ts.map +1 -0
- package/dist/schema-converter-structural-varying.js +170 -0
- package/dist/schema-converter-structural-varying.js.map +1 -0
- package/dist/schema-converter-structural.d.ts +8 -0
- package/dist/schema-converter-structural.d.ts.map +1 -0
- package/dist/schema-converter-structural.js +81 -0
- package/dist/schema-converter-structural.js.map +1 -0
- package/dist/schema-converter-userdefined-label.d.ts +8 -0
- package/dist/schema-converter-userdefined-label.d.ts.map +1 -0
- package/dist/schema-converter-userdefined-label.js +60 -0
- package/dist/schema-converter-userdefined-label.js.map +1 -0
- package/dist/schema-converter-userdefined.d.ts +15 -0
- package/dist/schema-converter-userdefined.d.ts.map +1 -0
- package/dist/schema-converter-userdefined.js +59 -0
- package/dist/schema-converter-userdefined.js.map +1 -0
- package/dist/schema-converter-value-forms.d.ts +12 -0
- package/dist/schema-converter-value-forms.d.ts.map +1 -0
- package/dist/schema-converter-value-forms.js +188 -0
- package/dist/schema-converter-value-forms.js.map +1 -0
- package/dist/schema-converter.d.ts +2 -8
- package/dist/schema-converter.d.ts.map +1 -1
- package/dist/schema-converter.js +57 -68
- package/dist/schema-converter.js.map +1 -1
- package/dist/schema-enum-policy.d.ts +5 -1
- package/dist/schema-enum-policy.d.ts.map +1 -1
- package/dist/schema-enum-policy.js +21 -1
- package/dist/schema-enum-policy.js.map +1 -1
- package/dist/schema-grid-frames.d.ts +19 -0
- package/dist/schema-grid-frames.d.ts.map +1 -0
- package/dist/schema-grid-frames.js +84 -0
- package/dist/schema-grid-frames.js.map +1 -0
- package/dist/schema-ifc2x3-placements.d.ts +12 -0
- package/dist/schema-ifc2x3-placements.d.ts.map +1 -0
- package/dist/schema-ifc2x3-placements.js +297 -0
- package/dist/schema-ifc2x3-placements.js.map +1 -0
- package/dist/schema-ifc2x3-records.d.ts +58 -0
- package/dist/schema-ifc2x3-records.d.ts.map +1 -0
- package/dist/schema-ifc2x3-records.js +179 -0
- package/dist/schema-ifc2x3-records.js.map +1 -0
- package/dist/schema-style-flatten.d.ts +7 -2
- package/dist/schema-style-flatten.d.ts.map +1 -1
- package/dist/schema-style-flatten.js +34 -2
- package/dist/schema-style-flatten.js.map +1 -1
- package/dist/schema-value-form-policy.d.ts +129 -0
- package/dist/schema-value-form-policy.d.ts.map +1 -0
- package/dist/schema-value-form-policy.js +222 -0
- package/dist/schema-value-form-policy.js.map +1 -0
- package/dist/section-export.d.ts.map +1 -1
- package/dist/section-export.js +3 -2
- package/dist/section-export.js.map +1 -1
- package/dist/select-qualification.d.ts.map +1 -1
- package/dist/select-qualification.js +6 -5
- package/dist/select-qualification.js.map +1 -1
- package/dist/step-collection.d.ts.map +1 -1
- package/dist/step-collection.js +5 -0
- package/dist/step-collection.js.map +1 -1
- package/dist/step-comment-skip.d.ts +8 -0
- package/dist/step-comment-skip.d.ts.map +1 -1
- package/dist/step-comment-skip.js +28 -0
- package/dist/step-comment-skip.js.map +1 -1
- package/dist/step-coordinate-options.d.ts +15 -0
- package/dist/step-coordinate-options.d.ts.map +1 -1
- package/dist/step-coordinate-options.js +13 -1
- package/dist/step-coordinate-options.js.map +1 -1
- package/dist/step-derived-quantities.d.ts +23 -0
- package/dist/step-derived-quantities.d.ts.map +1 -0
- package/dist/step-derived-quantities.js +50 -0
- package/dist/step-derived-quantities.js.map +1 -0
- package/dist/step-export-types.d.ts +2 -1
- package/dist/step-export-types.d.ts.map +1 -1
- package/dist/step-export-types.js.map +1 -1
- package/dist/step-exporter.d.ts +0 -6
- package/dist/step-exporter.d.ts.map +1 -1
- package/dist/step-exporter.js +11 -7
- package/dist/step-exporter.js.map +1 -1
- package/dist/step-georeferencing.d.ts +2 -0
- package/dist/step-georeferencing.d.ts.map +1 -1
- package/dist/step-georeferencing.js +122 -46
- package/dist/step-georeferencing.js.map +1 -1
- package/dist/step-header.d.ts.map +1 -1
- package/dist/step-header.js +4 -1
- package/dist/step-header.js.map +1 -1
- package/dist/step-internal-pset-ids.d.ts +7 -0
- package/dist/step-internal-pset-ids.d.ts.map +1 -0
- package/dist/step-internal-pset-ids.js +25 -0
- package/dist/step-internal-pset-ids.js.map +1 -0
- package/dist/step-map-unit-normalization.d.ts.map +1 -1
- package/dist/step-map-unit-normalization.js +10 -3
- package/dist/step-map-unit-normalization.js.map +1 -1
- package/dist/step-map-unit.d.ts +8 -1
- package/dist/step-map-unit.d.ts.map +1 -1
- package/dist/step-map-unit.js +13 -5
- package/dist/step-map-unit.js.map +1 -1
- package/dist/step-native-set-record.d.ts +2 -0
- package/dist/step-native-set-record.d.ts.map +1 -1
- package/dist/step-native-set-record.js +10 -0
- package/dist/step-native-set-record.js.map +1 -1
- package/dist/step-omission-predicates.d.ts.map +1 -1
- package/dist/step-omission-predicates.js +1 -0
- package/dist/step-omission-predicates.js.map +1 -1
- package/dist/step-overlay-entities.d.ts +0 -35
- package/dist/step-overlay-entities.d.ts.map +1 -1
- package/dist/step-overlay-entities.js +40 -4
- package/dist/step-overlay-entities.js.map +1 -1
- package/dist/step-overlay-property-base.d.ts +13 -0
- package/dist/step-overlay-property-base.d.ts.map +1 -0
- package/dist/step-overlay-property-base.js +30 -0
- package/dist/step-overlay-property-base.js.map +1 -0
- package/dist/step-pass-builder.d.ts.map +1 -1
- package/dist/step-pass-builder.js +13 -0
- package/dist/step-pass-builder.js.map +1 -1
- package/dist/step-property-set-collection.d.ts.map +1 -1
- package/dist/step-property-set-collection.js +7 -2
- package/dist/step-property-set-collection.js.map +1 -1
- package/dist/step-property-set-generators.d.ts.map +1 -1
- package/dist/step-property-set-generators.js +8 -4
- package/dist/step-property-set-generators.js.map +1 -1
- package/dist/step-property-set-index.js +1 -1
- package/dist/step-property-set-index.js.map +1 -1
- package/dist/step-property-set-readers.d.ts.map +1 -1
- package/dist/step-property-set-readers.js +6 -5
- package/dist/step-property-set-readers.js.map +1 -1
- package/dist/step-pset-copy-on-write.d.ts.map +1 -1
- package/dist/step-pset-copy-on-write.js +9 -7
- package/dist/step-pset-copy-on-write.js.map +1 -1
- package/dist/step-record-frame.d.ts +5 -3
- package/dist/step-record-frame.d.ts.map +1 -1
- package/dist/step-record-frame.js +12 -8
- package/dist/step-record-frame.js.map +1 -1
- package/dist/step-ref-scan.d.ts +7 -0
- package/dist/step-ref-scan.d.ts.map +1 -1
- package/dist/step-ref-scan.js +24 -3
- package/dist/step-ref-scan.js.map +1 -1
- package/dist/step-serialization.d.ts +13 -1
- package/dist/step-serialization.d.ts.map +1 -1
- package/dist/step-serialization.js +29 -2
- package/dist/step-serialization.js.map +1 -1
- package/dist/step-shared-atom-retention.js +1 -1
- package/dist/step-shared-atom-retention.js.map +1 -1
- package/dist/step-slot-grammar.d.ts +2 -0
- package/dist/step-slot-grammar.d.ts.map +1 -1
- package/dist/step-slot-grammar.js +5 -0
- package/dist/step-slot-grammar.js.map +1 -1
- package/dist/step-source-iteration.d.ts.map +1 -1
- package/dist/step-source-iteration.js +7 -2
- package/dist/step-source-iteration.js.map +1 -1
- package/dist/subset-entity-reader.d.ts.map +1 -1
- package/dist/subset-entity-reader.js +15 -8
- package/dist/subset-entity-reader.js.map +1 -1
- package/dist/subset-roots.d.ts +4 -14
- package/dist/subset-roots.d.ts.map +1 -1
- package/dist/subset-roots.js +14 -4
- package/dist/subset-roots.js.map +1 -1
- package/dist/unit-normalize.d.ts.map +1 -1
- package/dist/unit-normalize.js +4 -3
- package/dist/unit-normalize.js.map +1 -1
- package/dist/viewer-georef-scale.d.ts +14 -0
- package/dist/viewer-georef-scale.d.ts.map +1 -0
- package/dist/viewer-georef-scale.js +20 -0
- package/dist/viewer-georef-scale.js.map +1 -0
- package/package.json +43 -10
|
@@ -0,0 +1,260 @@
|
|
|
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
|
+
* Normalize and georeferencing (#10886). A model normalized into the primary's length unit loses its own project
|
|
6
|
+
* unit, so its georeference must not lean on it:
|
|
7
|
+
*
|
|
8
|
+
* - A coordinate operation always targets a CRS (`TargetCRS` is an IfcCoordinateReferenceSystem in IFC4 and IFC4X3),
|
|
9
|
+
* and its offsets are in that CRS's unit (MapUnit, or HeightUnit for a geographic CRS), so they are left as written.
|
|
10
|
+
* - A CRS with no unit there is read as metres, as the viewer reads it (`@ifc-lite/geo` `map-unit.ts`), and is
|
|
11
|
+
* given the merge's one metre unit ({@link MintedRecords}) so every reader agrees.
|
|
12
|
+
* - A context-to-CRS map conversion's Scale carries project-unit distances into map units. Divide it by the
|
|
13
|
+
* length factor unless keeping it as written preserves the viewer's scale (see {@link viewerAxisScales}).
|
|
14
|
+
* A CRS-to-CRS conversion keeps its Scale because its source unit is unchanged.
|
|
15
|
+
*
|
|
16
|
+
* IFC2X3 spells the same georeference as the `ePSet_MapConversion` and `ePSet_ProjectedCRS` property sets (#10915),
|
|
17
|
+
* and they follow the same rule: the offset properties are left as written, a CRS set without a MapUnit is given a
|
|
18
|
+
* `METRE` one, and the Scale property is chosen as above. Their values come from the parser's own reading, the one
|
|
19
|
+
* the viewer places the model by, so the plan never reads a property value itself.
|
|
20
|
+
*/
|
|
21
|
+
import { decodeStepStringLiteral } from '@ifc-lite/encoding';
|
|
22
|
+
import { extractGeoreferenceCandidatesOnDemand } from '@ifc-lite/parser';
|
|
23
|
+
import { COORDINATE_OPERATION_STEP_TYPES, MAP_CONVERSION_STEP_TYPES } from './georef-closure.js';
|
|
24
|
+
import { refsIn } from './merged-project-contexts.js';
|
|
25
|
+
import { decodeEntity, getStepAttr } from './merged-subcontext.js';
|
|
26
|
+
import { slotUnset, stepString } from './schema-converter-structural-source.js';
|
|
27
|
+
import { splitTopLevelStepArguments } from './step-argument-parser.js';
|
|
28
|
+
import { namesAnyRecord } from './step-ref-scan.js';
|
|
29
|
+
import { frameArgs, stepRecordFrame, withFrameArgs } from './step-record-frame.js';
|
|
30
|
+
import { computeNormalizeFactor, toStepRealScaled } from './unit-normalize.js';
|
|
31
|
+
import { viewerAxisScales } from './viewer-georef-scale.js';
|
|
32
|
+
/** Records minted as their references are written, at ids past every source model's. */
|
|
33
|
+
export class MintedRecords {
|
|
34
|
+
nextId;
|
|
35
|
+
lines = [];
|
|
36
|
+
metreRef;
|
|
37
|
+
constructor(nextId) {
|
|
38
|
+
this.nextId = nextId;
|
|
39
|
+
}
|
|
40
|
+
/** Every property gets its own identity, even when its text matches another's. */
|
|
41
|
+
addProperty(text) { return this.add(text); }
|
|
42
|
+
/** A single SI unit can be referenced by multiple coordinate reference systems. */
|
|
43
|
+
useMetreUnit() { return this.metreRef ??= this.add(METRE_UNIT); }
|
|
44
|
+
appendTo(lines) {
|
|
45
|
+
for (const line of this.lines)
|
|
46
|
+
lines.push(line);
|
|
47
|
+
}
|
|
48
|
+
add(text) {
|
|
49
|
+
const ref = `#${this.nextId++}`;
|
|
50
|
+
this.lines.push(`${ref}=${text};`);
|
|
51
|
+
return ref;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** Plans a new property for the set, replacing its list entry at `at` or appending one. */
|
|
55
|
+
function listEntry(records, setId, text, at) {
|
|
56
|
+
const record = records.get(setId);
|
|
57
|
+
const entries = record?.kind === 'list' ? record.entries.filter(entry => at === undefined || entry.at !== at) : [];
|
|
58
|
+
records.set(setId, { kind: 'list', attr: PSET_PROPERTIES_ATTR, entries: [...entries, { at, text }] });
|
|
59
|
+
}
|
|
60
|
+
/** 0-based index of the CRS's length unit: `IfcProjectedCRS.MapUnit` (IFC4, IFC4X3), `IfcGeographicCRS.HeightUnit`. */
|
|
61
|
+
const CRS_UNIT_ATTR = { IFCPROJECTEDCRS: 6, IFCGEOGRAPHICCRS: 5 };
|
|
62
|
+
/** 0-based index of `IfcMapConversion.Scale`. */
|
|
63
|
+
const SCALE_ATTR = 7;
|
|
64
|
+
/** 0-based `IfcPropertySet.HasProperties`, `IfcPropertySingleValue.Name`, `.Description` and `.Unit`. */
|
|
65
|
+
const PSET_PROPERTIES_ATTR = 4, PROPERTY_NAME_ATTR = 0, PROPERTY_DESCRIPTION_ATTR = 1, PROPERTY_UNIT_ATTR = 3;
|
|
66
|
+
const METRE_UNIT = 'IFCSIUNIT(*,.LENGTHUNIT.,$,.METRE.)';
|
|
67
|
+
/** The ePSet_MapConversion placement properties, by the names the parser reads (`EPSET_TRANSFORM_PROPERTIES`). */
|
|
68
|
+
const EPSET_PLACEMENT = new Set(['Eastings', 'Northings', 'OrthogonalHeight', 'XAxisAbscissa', 'XAxisOrdinate', 'Scale']);
|
|
69
|
+
// @raw-entity-enumeration-ok MergeExporter uses a reparsed effective STEP snapshot, so these are the merged input's current records
|
|
70
|
+
const idsOf = (dataStore, types) => [...types].flatMap(type => dataStore.entityIndex.byType.get(type) ?? []);
|
|
71
|
+
/** A STEP string slot's decoded text, as the parser decodes it, or '' when it is no string. */
|
|
72
|
+
const label = (raw) => { const text = stepString(raw ?? undefined); return text === null ? '' : decodeStepStringLiteral(text); };
|
|
73
|
+
/** The record type of `id`, a deferred property atom included. */
|
|
74
|
+
// @raw-entity-enumeration-ok MergeExporter uses a reparsed effective STEP snapshot, so these are the merged input's current records
|
|
75
|
+
const typeOf = (dataStore, id) => (dataStore.entityIndex.byId.get(id) ?? dataStore.deferredEntityIndex?.get(id))?.type?.toUpperCase();
|
|
76
|
+
/** The normalize advisory for a model's georeference, or null when it carries none. */
|
|
77
|
+
export function georefNormalizeCaveat(name, dataStore, plan) {
|
|
78
|
+
if (idsOf(dataStore, COORDINATE_OPERATION_STEP_TYPES).length === 0 && !plan?.records.size && !plan?.implicitUnit.length
|
|
79
|
+
&& !plan?.scaleLeft.length)
|
|
80
|
+
return null;
|
|
81
|
+
const idsIn = (ids) => `${ids.map(id => `#${id}`).join(', ')} (${ids.length === 1 ? 'an id' : 'ids'} in "${name}")`;
|
|
82
|
+
const unkeptIds = plan?.unkept ?? [], implicitIds = plan?.implicitUnit ?? [], leftIds = plan?.scaleLeft ?? [];
|
|
83
|
+
const unkept = unkeptIds.length === 0 ? '' : unkeptIds.length === 1
|
|
84
|
+
? ` The viewer cannot show its map conversion ${idsIn(unkeptIds)} at its own scale in the merged unit, so its Scale is written as the IFC specification reads it.`
|
|
85
|
+
: ` The viewer cannot show its map conversions ${idsIn(unkeptIds)} at their own scale in the merged unit, so their Scale is written as the IFC specification reads it.`;
|
|
86
|
+
const implicit = implicitIds.length === 0 ? '' : ` The map unit of ePSet_MapConversion ${idsIn(implicitIds)} stays ` +
|
|
87
|
+
'implicit, with no ePSet_ProjectedCRS or no MapUnit normalize could write; the viewer reads it as metres.';
|
|
88
|
+
const left = leftIds.length === 0 ? '' : ` Normalize could not rewrite the Scale property of ePSet_MapConversion ` +
|
|
89
|
+
`${idsIn(leftIds)}, so the viewer shows it at another scale in the merged unit.`;
|
|
90
|
+
return `Model "${name}" carries georeferencing, whose offsets normalize leaves in the CRS unit (a CRS without one ` +
|
|
91
|
+
`is written in metres). If the model was georeferenced in its own unit, review the merged georeference.${unkept}${implicit}${left}`;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The Scale that keeps the scale the viewer gives a conversion's geometry once its model is normalized: the divided
|
|
95
|
+
* Scale (the spec reading) as it will be written, else undefined to keep it as written; `unkept` when neither keeps it,
|
|
96
|
+
* and `keepsWritten` when the Scale as written keeps it.
|
|
97
|
+
*/
|
|
98
|
+
function chooseScale(conversion, mapUnitScale, modelScale, primaryScale) {
|
|
99
|
+
const alone = viewerAxisScales(conversion, mapUnitScale, modelScale);
|
|
100
|
+
const keeps = (scale) => viewerAxisScales({ ...conversion, scale }, mapUnitScale, primaryScale)
|
|
101
|
+
.every((value, axis) => Math.abs(value - alone[axis]) <= 1e-9 * Math.abs(alone[axis])); // relative: scales can be tiny
|
|
102
|
+
// As written: a value that rounds to within 1e-9 of 1 reads as unset in the viewer.
|
|
103
|
+
const divided = Number(toStepRealScaled((conversion.scale ?? 1) / computeNormalizeFactor(modelScale, primaryScale)));
|
|
104
|
+
const keepsWritten = keeps(conversion.scale);
|
|
105
|
+
if (keeps(divided))
|
|
106
|
+
return { scale: divided, unkept: false, keepsWritten };
|
|
107
|
+
return keepsWritten ? { scale: undefined, unkept: false, keepsWritten } : { scale: divided, unkept: true, keepsWritten };
|
|
108
|
+
}
|
|
109
|
+
/** The {@link GeorefNormalizePlan} of a model in length unit `modelScale` normalized into `primaryScale`. */
|
|
110
|
+
export function planGeorefNormalize(dataStore, minted, modelScale, primaryScale) {
|
|
111
|
+
const records = new Map(), unkept = [], implicitUnit = [], scaleLeft = [];
|
|
112
|
+
for (const id of idsOf(dataStore, COORDINATE_OPERATION_STEP_TYPES))
|
|
113
|
+
records.set(id, { kind: 'keep' });
|
|
114
|
+
for (const [type, attr] of Object.entries(CRS_UNIT_ATTR)) {
|
|
115
|
+
for (const id of idsOf(dataStore, [type])) {
|
|
116
|
+
if (!slotUnset(getStepAttr(dataStore, id, attr) ?? '$'))
|
|
117
|
+
continue;
|
|
118
|
+
records.set(id, { kind: 'metre-unit', attr });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// @raw-entity-enumeration-ok MergeExporter uses a reparsed effective STEP snapshot
|
|
122
|
+
const hasPropertySets = dataStore.entityIndex.byType.has('IFCPROPERTYSET');
|
|
123
|
+
const candidates = hasPropertySets || idsOf(dataStore, MAP_CONVERSION_STEP_TYPES).length
|
|
124
|
+
? extractGeoreferenceCandidatesOnDemand(dataStore) : null;
|
|
125
|
+
for (const { conversion, targetCRS } of candidates?.mapConversions ?? []) {
|
|
126
|
+
// @raw-entity-enumeration-ok MergeExporter uses a reparsed effective STEP snapshot
|
|
127
|
+
const source = dataStore.entityIndex.byId.get(conversion.sourceCRS);
|
|
128
|
+
if (source?.type !== 'IFCGEOMETRICREPRESENTATIONCONTEXT')
|
|
129
|
+
continue;
|
|
130
|
+
const choice = chooseScale(conversion, targetCRS?.mapUnitScale, modelScale, primaryScale);
|
|
131
|
+
if (choice.scale !== undefined)
|
|
132
|
+
records.set(conversion.id, { kind: 'edit', attr: SCALE_ATTR, value: toStepRealScaled(choice.scale) });
|
|
133
|
+
if (choice.unkept)
|
|
134
|
+
unkept.push(conversion.id);
|
|
135
|
+
}
|
|
136
|
+
// Only the ePSet the viewer uses has offsets in the map unit and axis and Scale ratios to preserve.
|
|
137
|
+
const epset = candidates?.entities.hasGeoreference ? undefined : candidates?.ePSetMapConversion;
|
|
138
|
+
const plan = { records, minted, unkept, implicitUnit, scaleLeft };
|
|
139
|
+
if (epset?.mapConversion) {
|
|
140
|
+
keepEPSetPlacement(dataStore, epset.mapConversion.id, records);
|
|
141
|
+
planViewerEPSet(dataStore, epset.mapConversion, epset.projectedCRS, plan, modelScale, primaryScale);
|
|
142
|
+
}
|
|
143
|
+
return plan;
|
|
144
|
+
}
|
|
145
|
+
/** Copy placement properties so their originals can be rescaled for any other set that uses them. */
|
|
146
|
+
function keepEPSetPlacement(dataStore, setId, records) {
|
|
147
|
+
const list = getStepAttr(dataStore, setId, PSET_PROPERTIES_ATTR);
|
|
148
|
+
if (list === null)
|
|
149
|
+
return;
|
|
150
|
+
for (const [at, ref] of refsIn(list).entries()) {
|
|
151
|
+
const id = Number(ref.slice(1));
|
|
152
|
+
const name = getStepAttr(dataStore, id, PROPERTY_NAME_ATTR);
|
|
153
|
+
if (name !== null && !EPSET_PLACEMENT.has(label(name)))
|
|
154
|
+
continue;
|
|
155
|
+
const copy = recordBody(decodeEntity(dataStore, id));
|
|
156
|
+
// Copies are emitted directly. Keep the original if it needs reference remapping or schema conversion.
|
|
157
|
+
if (name === null || copy === undefined || namesAnyRecord(copy) || typeOf(dataStore, id) !== 'IFCPROPERTYSINGLEVALUE') {
|
|
158
|
+
records.set(id, { kind: 'keep' });
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
listEntry(records, setId, copy, at);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/** A record's text from its type name to its closing `)`, as the package's record frame reads it, or undefined. */
|
|
166
|
+
function recordBody(text) {
|
|
167
|
+
if (text === null)
|
|
168
|
+
return undefined;
|
|
169
|
+
const frame = stepRecordFrame(text, { allowMissingSemicolon: true });
|
|
170
|
+
return frame ? text.slice(frame.head.typeStart, frame.close + 1) : undefined;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* A set's properties with their names and positions in its list, `editable` when a single value without its own
|
|
174
|
+
* Unit; null when the set's property list cannot be read. A property that cannot be read is passed over, as the
|
|
175
|
+
* parser passes it over.
|
|
176
|
+
*/
|
|
177
|
+
function propertiesOf(dataStore, setId) {
|
|
178
|
+
const list = getStepAttr(dataStore, setId, PSET_PROPERTIES_ATTR);
|
|
179
|
+
if (list === null)
|
|
180
|
+
return null;
|
|
181
|
+
const properties = [];
|
|
182
|
+
for (const [at, ref] of refsIn(list).entries()) {
|
|
183
|
+
const id = Number(ref.slice(1)), name = getStepAttr(dataStore, id, PROPERTY_NAME_ATTR);
|
|
184
|
+
if (name === null)
|
|
185
|
+
continue;
|
|
186
|
+
const editable = typeOf(dataStore, id) === 'IFCPROPERTYSINGLEVALUE' && slotUnset(getStepAttr(dataStore, id, PROPERTY_UNIT_ATTR) ?? '$');
|
|
187
|
+
properties.push({ at, name: label(name), description: getStepAttr(dataStore, id, PROPERTY_DESCRIPTION_ATTR) ?? '$', editable });
|
|
188
|
+
}
|
|
189
|
+
return properties;
|
|
190
|
+
}
|
|
191
|
+
/** Plans the ePSet the viewer reads, from the parser's `conversion` and `crs` (whose id is the conversion's own when the model has no ePSet_ProjectedCRS). */
|
|
192
|
+
function planViewerEPSet(dataStore, conversion, crs, plan, modelScale, primaryScale) {
|
|
193
|
+
const { records, unkept, implicitUnit, scaleLeft } = plan;
|
|
194
|
+
// Gives the set a new `name` property of `value` (with the replaced one's Description) in place of the last one so
|
|
195
|
+
// named (the one the parser reads), or appended when it has none. The old record is left as it is, for any other
|
|
196
|
+
// set that lists it too. False when the property is no editable single value, or the set cannot be read, and the set
|
|
197
|
+
// is left as it is.
|
|
198
|
+
const write = (setId, name, value) => {
|
|
199
|
+
const of = propertiesOf(dataStore, setId);
|
|
200
|
+
const last = of?.filter(property => property.name === name).at(-1);
|
|
201
|
+
if (!of || (last !== undefined && !last.editable))
|
|
202
|
+
return false;
|
|
203
|
+
listEntry(records, setId, `IFCPROPERTYSINGLEVALUE('${name}',${last?.description ?? '$'},${value},$)`, last?.at);
|
|
204
|
+
return true;
|
|
205
|
+
};
|
|
206
|
+
const hasCrsSet = crs !== undefined && crs.id !== conversion.id;
|
|
207
|
+
const unitExplicit = hasCrsSet && (crs.mapUnit !== undefined || write(crs.id, 'MapUnit', "IFCLABEL('METRE')"));
|
|
208
|
+
if (!unitExplicit)
|
|
209
|
+
implicitUnit.push(conversion.id);
|
|
210
|
+
const choice = chooseScale(conversion, crs?.mapUnitScale, modelScale, primaryScale);
|
|
211
|
+
if (choice.scale === undefined)
|
|
212
|
+
return;
|
|
213
|
+
if (write(conversion.id, 'Scale', `IFCREAL(${toStepRealScaled(choice.scale)})`)) {
|
|
214
|
+
if (choice.unkept)
|
|
215
|
+
unkept.push(conversion.id);
|
|
216
|
+
}
|
|
217
|
+
else if (!choice.keepsWritten)
|
|
218
|
+
scaleLeft.push(conversion.id);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* A georeference record of a normalized model, in output ids, as the output unit needs it; undefined for any other
|
|
222
|
+
* record, which the caller rescales as usual.
|
|
223
|
+
*/
|
|
224
|
+
export function normalizeGeorefRecord(text, sourceId, plan) {
|
|
225
|
+
const record = plan?.records.get(sourceId);
|
|
226
|
+
if (!plan || record === undefined)
|
|
227
|
+
return undefined;
|
|
228
|
+
if (record.kind === 'keep')
|
|
229
|
+
return text;
|
|
230
|
+
const { attr } = record;
|
|
231
|
+
return withArgs(text, attr, args => {
|
|
232
|
+
if (record.kind === 'edit') {
|
|
233
|
+
args[attr] = record.value;
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (record.kind === 'metre-unit') {
|
|
237
|
+
args[attr] = plan.minted.useMetreUnit();
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const refs = refsIn(args[attr]);
|
|
241
|
+
for (const { at, text } of record.entries) {
|
|
242
|
+
const ref = plan.minted.addProperty(text);
|
|
243
|
+
if (at === undefined)
|
|
244
|
+
refs.push(ref);
|
|
245
|
+
else
|
|
246
|
+
refs[at] = ref;
|
|
247
|
+
}
|
|
248
|
+
args[attr] = `(${refs.join(',')})`;
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/** `text` with its arguments edited by `edit`, or unchanged when it has no argument at `index`. */
|
|
252
|
+
function withArgs(text, index, edit) {
|
|
253
|
+
const frame = stepRecordFrame(text, { allowMissingSemicolon: true });
|
|
254
|
+
const args = frame && splitTopLevelStepArguments(frameArgs(text, frame));
|
|
255
|
+
if (!frame || !args || args.length <= index)
|
|
256
|
+
return text;
|
|
257
|
+
edit(args);
|
|
258
|
+
return withFrameArgs(text, frame, args.join(','));
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=merged-georef-normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merged-georef-normalize.js","sourceRoot":"","sources":["../src/merged-georef-normalize.ts"],"names":[],"mappings":"AA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C,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK;QAAE,OAAO,IAAI,CAAC;IACzD,IAAI,CAAC,IAAI,CAAC,CAAC;IACX,OAAO,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** 0-based attribute index of `IfcContext.RepresentationContexts` (IfcProject in IFC2X3 and IFC4, IfcProjectLibrary). */
|
|
2
|
+
export declare const PROJECT_REPRESENTATION_CONTEXTS_ATTR = 7;
|
|
3
|
+
/** The `#N` references in an attribute slot of references (`$` has none); its comments are not read. */
|
|
4
|
+
export declare const refsIn: (slot: string) => string[];
|
|
5
|
+
/**
|
|
6
|
+
* List `contextIds` in the merged project's RepresentationContexts (#10798). A compatible later model's IfcProject
|
|
7
|
+
* folds into the primary's, so a top-level context of it that was kept rather than unified (a different frame or
|
|
8
|
+
* georeference, or a second context its own project listed) belongs to no project otherwise. Only
|
|
9
|
+
* ids written to `lines` are listed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function listKeptContexts(lines: string[], projectId: number | undefined, contextIds: readonly number[]): void;
|
|
12
|
+
//# sourceMappingURL=merged-project-contexts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merged-project-contexts.d.ts","sourceRoot":"","sources":["../src/merged-project-contexts.ts"],"names":[],"mappings":"AAYA,yHAAyH;AACzH,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD,wGAAwG;AACxG,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,KAAG,MAAM,EAAgE,CAAC;AAE7G;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAiBpH"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
* The merged IfcProject's RepresentationContexts: a compatible later model's IfcProject folds into the primary's, so
|
|
6
|
+
* the contexts it kept are listed there (#10798).
|
|
7
|
+
*/
|
|
8
|
+
import { splitTopLevelStepArguments } from './step-argument-parser.js';
|
|
9
|
+
import { frameArgs, stepRecordFrame, withFrameArgs } from './step-record-frame.js';
|
|
10
|
+
/** 0-based attribute index of `IfcContext.RepresentationContexts` (IfcProject in IFC2X3 and IFC4, IfcProjectLibrary). */
|
|
11
|
+
export const PROJECT_REPRESENTATION_CONTEXTS_ATTR = 7;
|
|
12
|
+
/** The `#N` references in an attribute slot of references (`$` has none); its comments are not read. */
|
|
13
|
+
export const refsIn = (slot) => slot.replace(/\/\*[\s\S]*?\*\//g, '').match(/#\d+/g) ?? [];
|
|
14
|
+
/**
|
|
15
|
+
* List `contextIds` in the merged project's RepresentationContexts (#10798). A compatible later model's IfcProject
|
|
16
|
+
* folds into the primary's, so a top-level context of it that was kept rather than unified (a different frame or
|
|
17
|
+
* georeference, or a second context its own project listed) belongs to no project otherwise. Only
|
|
18
|
+
* ids written to `lines` are listed.
|
|
19
|
+
*/
|
|
20
|
+
export function listKeptContexts(lines, projectId, contextIds) {
|
|
21
|
+
if (projectId === undefined || contextIds.length === 0)
|
|
22
|
+
return;
|
|
23
|
+
const wanted = new Set(contextIds), written = [];
|
|
24
|
+
let projectIndex = -1;
|
|
25
|
+
// Stops once the project and every kept context are found.
|
|
26
|
+
for (let index = 0; index < lines.length && (projectIndex < 0 || written.length < wanted.size); index++) {
|
|
27
|
+
const id = leadingId(lines[index]);
|
|
28
|
+
if (id === projectId)
|
|
29
|
+
projectIndex = index;
|
|
30
|
+
else if (wanted.has(id))
|
|
31
|
+
written.push(id);
|
|
32
|
+
}
|
|
33
|
+
if (projectIndex < 0 || written.length === 0)
|
|
34
|
+
return;
|
|
35
|
+
const text = lines[projectIndex], frame = stepRecordFrame(text, { allowMissingSemicolon: true });
|
|
36
|
+
const args = frame && splitTopLevelStepArguments(frameArgs(text, frame));
|
|
37
|
+
if (!frame || !args || args.length <= PROJECT_REPRESENTATION_CONTEXTS_ATTR)
|
|
38
|
+
return;
|
|
39
|
+
// The slot holds references only, so it is rewritten from them: `(#2) /* c */` and `$ /* c */` read as the list.
|
|
40
|
+
args[PROJECT_REPRESENTATION_CONTEXTS_ATTR] = `(${[...refsIn(args[PROJECT_REPRESENTATION_CONTEXTS_ATTR]), ...written.map(id => `#${id}`)].join(',')})`;
|
|
41
|
+
lines[projectIndex] = withFrameArgs(text, frame, args.join(','));
|
|
42
|
+
}
|
|
43
|
+
/** The `#N` a STEP line starts with, or -1; read by char code, as it runs over every line of a merge. */
|
|
44
|
+
function leadingId(line) {
|
|
45
|
+
if (line.charCodeAt(0) !== 35)
|
|
46
|
+
return -1;
|
|
47
|
+
let id = 0, index = 1;
|
|
48
|
+
for (; index < line.length; index++) {
|
|
49
|
+
const digit = line.charCodeAt(index) - 48;
|
|
50
|
+
if (digit < 0 || digit > 9)
|
|
51
|
+
break;
|
|
52
|
+
id = id * 10 + digit;
|
|
53
|
+
}
|
|
54
|
+
return index > 1 ? id : -1;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=merged-project-contexts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merged-project-contexts.js","sourceRoot":"","sources":["../src/merged-project-contexts.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;GAGG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEnF,yHAAyH;AACzH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,C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zE,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,IAAI,oCAAoC;QAAE,OAAO;IACnF,iHAAiH;IACjH,IAAI,CAAC,oCAAoC,CAAC,GAAG,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACtJ,KAAK,CAAC,YAAY,CAAC,GAAG,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACnE,CAAC;AAED,yGAAyG;AACzG,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,EAAE;QAAE,OAAO,CAAC,CAAC,CAAC;IACzC,IAAI,EAAE,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;IACtB,OAAO,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QAC1C,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC;YAAE,MAAM;QAClC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7B,CAAC"}
|
package/dist/merged-remap.d.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* Only `#<digits>` tokens in code positions are rewritten; tokens inside
|
|
6
6
|
* single-quoted STEP strings (e.g. a 'Room #205' Name or a 'http://x#42'
|
|
7
7
|
* URL) are left untouched so string attribute values are not corrupted.
|
|
8
|
+
* A STEP comment is copied as it is too: an apostrophe in it opens no
|
|
9
|
+
* string, so the references after it are still remapped (#10968).
|
|
8
10
|
*/
|
|
9
11
|
export declare function remapEntityText(entityText: string, offset: number, sharedRemap: ReadonlyMap<number, number>): string;
|
|
10
12
|
//# sourceMappingURL=merged-remap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merged-remap.d.ts","sourceRoot":"","sources":["../src/merged-remap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"merged-remap.d.ts","sourceRoot":"","sources":["../src/merged-remap.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACvC,MAAM,CA6CR"}
|
package/dist/merged-remap.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* (`merged-empty-containers.ts`, `merged-subcontext.ts`).
|
|
11
11
|
*/
|
|
12
12
|
import { stepStringLiteralEnd } from '@ifc-lite/encoding';
|
|
13
|
+
import { skipStepComment } from './step-comment-skip.js';
|
|
13
14
|
/**
|
|
14
15
|
* Remap all #ID references in a STEP entity line.
|
|
15
16
|
* Applies offset to all IDs, then overrides with specific remappings.
|
|
@@ -17,6 +18,8 @@ import { stepStringLiteralEnd } from '@ifc-lite/encoding';
|
|
|
17
18
|
* Only `#<digits>` tokens in code positions are rewritten; tokens inside
|
|
18
19
|
* single-quoted STEP strings (e.g. a 'Room #205' Name or a 'http://x#42'
|
|
19
20
|
* URL) are left untouched so string attribute values are not corrupted.
|
|
21
|
+
* A STEP comment is copied as it is too: an apostrophe in it opens no
|
|
22
|
+
* string, so the references after it are still remapped (#10968).
|
|
20
23
|
*/
|
|
21
24
|
export function remapEntityText(entityText, offset, sharedRemap) {
|
|
22
25
|
const remapId = (originalId) => {
|
|
@@ -31,6 +34,13 @@ export function remapEntityText(entityText, offset, sharedRemap) {
|
|
|
31
34
|
let out = '';
|
|
32
35
|
for (let i = 0; i < entityText.length; i++) {
|
|
33
36
|
const char = entityText[i];
|
|
37
|
+
// An unclosed `/*` is no comment: read on, as before (#10968).
|
|
38
|
+
if (char === '/' && entityText[i + 1] === '*' && entityText.includes('*/', i + 2)) {
|
|
39
|
+
const stop = skipStepComment(entityText, i);
|
|
40
|
+
out += entityText.slice(i, stop);
|
|
41
|
+
i = stop - 1;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
34
44
|
if (char === "'") {
|
|
35
45
|
// The literal is copied verbatim. Where it ends is the shared rule: `''`
|
|
36
46
|
// and a `\S\'` PAGE operand stay inside it (#7589). Unterminated: the rest.
|
package/dist/merged-remap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merged-remap.js","sourceRoot":"","sources":["../src/merged-remap.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;GAOG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"merged-remap.js","sourceRoot":"","sources":["../src/merged-remap.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;GAOG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAkB,EAClB,MAAc,EACd,WAAwC;IAExC,MAAM,OAAO,GAAG,CAAC,UAAkB,EAAU,EAAE;QAC7C,yEAAyE;QACzE,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC7C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,IAAI,QAAQ,EAAE,CAAC;QACxB,CAAC;QACD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AC;YACd,OAAO,CAAC,GAAG,UAAU,CAAC,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,GAAG;gBAAE,CAAC,EAAE,CAAC;YAClF,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5D,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;YAC3B,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACV,SAAS;QACX,CAAC;QAED,GAAG,IAAI,IAAI,CAAC;IACd,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -26,6 +26,28 @@
|
|
|
26
26
|
* where applicable) rather than on raw array position.
|
|
27
27
|
*/
|
|
28
28
|
import type { IfcDataStore } from '@ifc-lite/parser';
|
|
29
|
+
export declare function decodeEntity(dataStore: IfcDataStore, expressId: number): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Extract one 0-based STEP attribute of `expressId`'s entity, or null if
|
|
32
|
+
* unreadable. `merged-context.ts` reads its WCS frames and georeferences
|
|
33
|
+
* through this one too, where null is likewise read as unresolvable.
|
|
34
|
+
*
|
|
35
|
+
* `splitTopLevelStepArguments` returning null (a malformed record, OR —
|
|
36
|
+
* since #4162's per-slot check — a well-formed record whose split it cannot
|
|
37
|
+
* vouch for) is one more way to land here, same as no source bytes or no
|
|
38
|
+
* record frame. `normalizeLabel` already turns a null attribute into `''`,
|
|
39
|
+
* the same key an actually-blank `ContextIdentifier`/`TargetView` gets, so a
|
|
40
|
+
* subcontext this can't read falls back to grouping with other blank-keyed
|
|
41
|
+
* subcontexts rather than being matched on a guessed kind — the failure mode
|
|
42
|
+
* this file's own docstring already treats as acceptable ("left un-remapped
|
|
43
|
+
* — kept as its own entity"). `ContextIdentifier`/`TargetView` are IFC label/
|
|
44
|
+
* enumeration attributes, not binary-typed ones, so #4162's per-slot check
|
|
45
|
+
* gaining binary-literal support does not change what is reachable here in
|
|
46
|
+
* practice — audited alongside the four other `splitTopLevelStepArguments`
|
|
47
|
+
* call sites, unlike `rescaleEntityLengths` (`unit-normalize.ts`), which
|
|
48
|
+
* throws: a length has no safe permissive fallback.
|
|
49
|
+
*/
|
|
50
|
+
export declare function getStepAttr(dataStore: IfcDataStore, expressId: number, index: number): string | null;
|
|
29
51
|
/** Group `ids` (a model's subcontext express ids) by {@link subContextKey}. */
|
|
30
52
|
export declare function groupSubContextsByKey(dataStore: IfcDataStore, ids: readonly number[]): Map<string, number[]>;
|
|
31
53
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merged-subcontext.d.ts","sourceRoot":"","sources":["../src/merged-subcontext.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"merged-subcontext.d.ts","sourceRoot":"","sources":["../src/merged-subcontext.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAYrD,wBAAgB,YAAY,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQtF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQpG;AA0BD,+EAA+E;AAC/E,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAQ5G;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,0BAA0B,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EACzD,gBAAgB,EAAE,MAAM,EACxB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,GACzB,IAAI,CAYN"}
|
|
@@ -1,40 +1,35 @@
|
|
|
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 { asSourceBytes
|
|
4
|
+
import { asSourceBytes } from '@ifc-lite/parser';
|
|
5
5
|
import { splitTopLevelStepArguments } from './step-argument-parser.js';
|
|
6
|
-
|
|
7
|
-
* `#N=TYPE(...)` record, with STEP trivia (whitespace and/or a
|
|
8
|
-
* `/* ... */` comment, #3789) tolerated between the type name and `(` —
|
|
9
|
-
* same adjacency fix as `entity-extractor.ts`'s `extractEntity`. Without it
|
|
10
|
-
* a wrapped record's attribute is silently unreadable here (`getStepAttr`
|
|
11
|
-
* returns `null`), which reads identically to a genuinely-absent attribute.
|
|
12
|
-
*/
|
|
13
|
-
const RECORD_RE = new RegExp(`^#\\d+\\s*=\\s*\\w+${STEP_TRIVIA}\\(([\\s\\S]*)\\)\\s*;?\\s*$`);
|
|
6
|
+
import { frameArgs, stepRecordFrame } from './step-record-frame.js';
|
|
14
7
|
/** 0-based attribute index of `IfcGeometricRepresentationSubContext.ContextIdentifier`. */
|
|
15
8
|
const CONTEXT_IDENTIFIER_ATTR = 0;
|
|
16
9
|
/** 0-based attribute index of `IfcGeometricRepresentationSubContext.TargetView`. */
|
|
17
10
|
const TARGET_VIEW_ATTR = 8;
|
|
18
11
|
/** 0-based attribute index of `IfcGeometricRepresentationSubContext.UserDefinedTargetView`. */
|
|
19
12
|
const USER_DEFINED_TARGET_VIEW_ATTR = 9;
|
|
20
|
-
function decodeEntity(dataStore, expressId) {
|
|
13
|
+
export function decodeEntity(dataStore, expressId) {
|
|
21
14
|
const source = dataStore.source;
|
|
22
15
|
if (!source)
|
|
23
16
|
return null;
|
|
24
|
-
//
|
|
25
|
-
|
|
17
|
+
// A property atom parsed with `deferPropertyAtomIndex` lives in the deferred index (#10915).
|
|
18
|
+
// @raw-entity-enumeration-ok decode one record's STEP byte span for the merge's context reads; MergeExporter bakes each edited input through STEP export and reparses it first
|
|
19
|
+
const ref = dataStore.entityIndex.byId.get(expressId) ?? dataStore.deferredEntityIndex?.get(expressId);
|
|
26
20
|
if (!ref)
|
|
27
21
|
return null;
|
|
28
22
|
return asSourceBytes(source).decodeUtf8(ref.byteOffset, ref.byteOffset + ref.byteLength);
|
|
29
23
|
}
|
|
30
24
|
/**
|
|
31
25
|
* Extract one 0-based STEP attribute of `expressId`'s entity, or null if
|
|
32
|
-
* unreadable.
|
|
26
|
+
* unreadable. `merged-context.ts` reads its WCS frames and georeferences
|
|
27
|
+
* through this one too, where null is likewise read as unresolvable.
|
|
33
28
|
*
|
|
34
29
|
* `splitTopLevelStepArguments` returning null (a malformed record, OR —
|
|
35
30
|
* since #4162's per-slot check — a well-formed record whose split it cannot
|
|
36
31
|
* vouch for) is one more way to land here, same as no source bytes or no
|
|
37
|
-
*
|
|
32
|
+
* record frame. `normalizeLabel` already turns a null attribute into `''`,
|
|
38
33
|
* the same key an actually-blank `ContextIdentifier`/`TargetView` gets, so a
|
|
39
34
|
* subcontext this can't read falls back to grouping with other blank-keyed
|
|
40
35
|
* subcontexts rather than being matched on a guessed kind — the failure mode
|
|
@@ -46,12 +41,13 @@ function decodeEntity(dataStore, expressId) {
|
|
|
46
41
|
* call sites, unlike `rescaleEntityLengths` (`unit-normalize.ts`), which
|
|
47
42
|
* throws: a length has no safe permissive fallback.
|
|
48
43
|
*/
|
|
49
|
-
function getStepAttr(dataStore, expressId, index) {
|
|
44
|
+
export function getStepAttr(dataStore, expressId, index) {
|
|
50
45
|
const text = decodeEntity(dataStore, expressId);
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
// The package's record frame: STEP trivia is allowed wherever a record allows it (around `=`, before `(` and `;`).
|
|
47
|
+
const frame = text == null ? null : stepRecordFrame(text, { allowMissingSemicolon: true });
|
|
48
|
+
if (!frame)
|
|
53
49
|
return null;
|
|
54
|
-
const args = splitTopLevelStepArguments(
|
|
50
|
+
const args = splitTopLevelStepArguments(frameArgs(text, frame));
|
|
55
51
|
const raw = args?.[index];
|
|
56
52
|
return raw === undefined ? null : raw.trim();
|
|
57
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merged-subcontext.js","sourceRoot":"","sources":["../src/merged-subcontext.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA+B/D,OAAO,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"merged-subcontext.js","sourceRoot":"","sources":["../src/merged-subcontext.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA+B/D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEpE,2FAA2F;AAC3F,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAClC,oFAAoF;AACpF,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,+FAA+F;AAC/F,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAExC,MAAM,UAAU,YAAY,CAAC,SAAuB,EAAE,SAAiB;IACrE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;IAChC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,6FAA6F;IAC7F,+KAA+K;IAC/K,MAAM,GAAG,GAAG,SAAS,CAAC,WAAW,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aAA0B;IAE1B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,KAAK,MAAM,EAAE,IAAI,OAAO,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,aAAa,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QACzC,MAAM,IAAI,GAAG,0BAA0B,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACzC,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM;YAAE,SAAS,CAAC,iDAAiD;QACnF,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;QAC5B,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,CAAC;QAClD,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
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
4
|
/**
|
|
5
|
-
* The `
|
|
5
|
+
* The `getNonRelRefListTypes()` (`nonrel-ref-list-types.ts`) sibling of
|
|
6
6
|
* `filterHiddenRefsFromRelationshipLine` (`reference-collector.ts`): narrows
|
|
7
7
|
* a parenthesised list attribute exactly as that function does, but NEVER
|
|
8
8
|
* withholds the line.
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* `IFCREL*` line that IS the association — `IfcRelContainedInSpatialStructure
|
|
24
24
|
* .RelatingStructure` naming a hidden storey has no other spelling for "this
|
|
25
25
|
* relationship no longer applies", so the relationship itself must go. The
|
|
26
|
-
* classes in `
|
|
26
|
+
* classes in `getNonRelRefListTypes()` are not relationships: `IfcCostItem`'s
|
|
27
27
|
* bare `OwnerHistory` (`IfcRoot`) or `IfcAppliedValue`'s bare `UnitBasis` are
|
|
28
28
|
* ordinary attributes of the entity's OWN record, not a link between two
|
|
29
29
|
* OTHER records. Withholding `#N=IFCCOSTITEM(...)` over its OwnerHistory
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
* not 'no forward reference', it is a second, different kind of invalid
|
|
45
45
|
* file." An earlier revision of this function answered every emptied list
|
|
46
46
|
* with `()` and reproduced exactly that invalid file. The right answer is
|
|
47
|
-
* NOT uniform, because the types in `
|
|
47
|
+
* NOT uniform, because the types in `getNonRelRefListTypes()` do not all
|
|
48
48
|
* declare their list attribute alike — two examples:
|
|
49
49
|
*
|
|
50
50
|
* - `IfcCostItem.CostValues` / `.CostQuantities`, `IfcAppliedValue`/
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
import { getSchemaRegistryForVersion } from '@ifc-lite/parser';
|
|
92
92
|
import { readStepSlots, splitTopLevelListItems } from './step-argument-parser.js';
|
|
93
93
|
import { BARE_REF_RE } from './reference-collector.js';
|
|
94
|
-
import {
|
|
94
|
+
import { getNonRelRefListRegistryNames } from './nonrel-ref-list-types.js';
|
|
95
95
|
function isRegistryVersion(version) {
|
|
96
96
|
return version === 'IFC2X3' || version === 'IFC4' || version === 'IFC4X3';
|
|
97
97
|
}
|
|
@@ -110,7 +110,7 @@ function isRegistryVersion(version) {
|
|
|
110
110
|
* {@link SchemaVersionWithRegistry} take this path automatically, by
|
|
111
111
|
* construction, with no version list to keep in sync here.
|
|
112
112
|
*
|
|
113
|
-
* Read PER SLOT because a type joins `
|
|
113
|
+
* Read PER SLOT because a type joins `getNonRelRefListTypes()` on the strength
|
|
114
114
|
* of ONE qualifying attribute, while this function rewrites every
|
|
115
115
|
* parenthesised slot on the line. `IfcTextureMap` qualifies through
|
|
116
116
|
* `Maps : LIST [1:?]` but also carries `Vertices : LIST [3:?]`;
|
|
@@ -120,7 +120,7 @@ function isRegistryVersion(version) {
|
|
|
120
120
|
* so each slot is held to its OWN declared lower bound.
|
|
121
121
|
*/
|
|
122
122
|
function readAggregateSlot(entityType, slotIndex, schemaVersion) {
|
|
123
|
-
const registryName =
|
|
123
|
+
const registryName = getNonRelRefListRegistryNames().get(entityType);
|
|
124
124
|
if (registryName === undefined || !isRegistryVersion(schemaVersion))
|
|
125
125
|
return undefined;
|
|
126
126
|
const attr = getSchemaRegistryForVersion(schemaVersion).entities[registryName]?.allAttributes?.[slotIndex];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nonrel-positional-ref-narrowing.js","sourceRoot":"","sources":["../src/nonrel-positional-ref-narrowing.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,OAAO,EAAE,2BAA2B,EAAkC,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"nonrel-positional-ref-narrowing.js","sourceRoot":"","sources":["../src/nonrel-positional-ref-narrowing.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,OAAO,EAAE,2BAA2B,EAAkC,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,4BAA4B,CA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