@ifc-lite/create 2.8.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/ifc-creator-alignment-referents.d.ts +35 -0
- package/dist/ifc-creator-alignment-referents.d.ts.map +1 -0
- package/dist/ifc-creator-alignment-referents.js +89 -0
- package/dist/ifc-creator-alignment-referents.js.map +1 -0
- package/dist/ifc-creator-alignment-vertical.d.ts +40 -0
- package/dist/ifc-creator-alignment-vertical.d.ts.map +1 -0
- package/dist/ifc-creator-alignment-vertical.js +182 -0
- package/dist/ifc-creator-alignment-vertical.js.map +1 -0
- package/dist/ifc-creator-alignment.d.ts +45 -0
- package/dist/ifc-creator-alignment.d.ts.map +1 -0
- package/dist/ifc-creator-alignment.js +173 -0
- package/dist/ifc-creator-alignment.js.map +1 -0
- package/dist/ifc-creator-header.d.ts +2 -0
- package/dist/ifc-creator-header.d.ts.map +1 -0
- package/dist/ifc-creator-header.js +22 -0
- package/dist/ifc-creator-header.js.map +1 -0
- package/dist/ifc-creator-math.d.ts +37 -5
- package/dist/ifc-creator-math.d.ts.map +1 -1
- package/dist/ifc-creator-math.js +93 -4
- package/dist/ifc-creator-math.js.map +1 -1
- package/dist/ifc-creator-relationships.d.ts +43 -0
- package/dist/ifc-creator-relationships.d.ts.map +1 -0
- package/dist/ifc-creator-relationships.js +38 -0
- package/dist/ifc-creator-relationships.js.map +1 -0
- package/dist/ifc-creator-styles.d.ts +22 -0
- package/dist/ifc-creator-styles.d.ts.map +1 -0
- package/dist/ifc-creator-styles.js +50 -0
- package/dist/ifc-creator-styles.js.map +1 -0
- package/dist/ifc-creator-terrain.d.ts +170 -0
- package/dist/ifc-creator-terrain.d.ts.map +1 -0
- package/dist/ifc-creator-terrain.js +180 -0
- package/dist/ifc-creator-terrain.js.map +1 -0
- package/dist/ifc-creator.d.ts +21 -7
- package/dist/ifc-creator.d.ts.map +1 -1
- package/dist/ifc-creator.js +93 -97
- package/dist/ifc-creator.js.map +1 -1
- package/dist/in-store/_emit-helpers.d.ts +2 -1
- package/dist/in-store/_emit-helpers.d.ts.map +1 -1
- package/dist/in-store/_emit-helpers.js +7 -7
- package/dist/in-store/_emit-helpers.js.map +1 -1
- package/dist/in-store/anchor.d.ts +2 -0
- package/dist/in-store/anchor.d.ts.map +1 -1
- package/dist/in-store/anchor.js.map +1 -1
- package/dist/in-store/apply-style.d.ts +3 -6
- package/dist/in-store/apply-style.d.ts.map +1 -1
- package/dist/in-store/apply-style.js +3 -77
- package/dist/in-store/apply-style.js.map +1 -1
- package/dist/in-store/column.d.ts.map +1 -1
- package/dist/in-store/column.js +2 -0
- package/dist/in-store/column.js.map +1 -1
- package/dist/in-store/door.d.ts.map +1 -1
- package/dist/in-store/door.js +2 -0
- package/dist/in-store/door.js.map +1 -1
- package/dist/in-store/extract-walls.d.ts +1 -1
- package/dist/in-store/extract-walls.d.ts.map +1 -1
- package/dist/in-store/extract-walls.js +37 -55
- package/dist/in-store/extract-walls.js.map +1 -1
- package/dist/in-store/generate-spaces-all.d.ts +6 -2
- package/dist/in-store/generate-spaces-all.d.ts.map +1 -1
- package/dist/in-store/generate-spaces-all.js +33 -9
- package/dist/in-store/generate-spaces-all.js.map +1 -1
- package/dist/in-store/generate-spaces.js +1 -1
- package/dist/in-store/generate-spaces.js.map +1 -1
- package/dist/in-store/placement-frame.d.ts +8 -0
- package/dist/in-store/placement-frame.d.ts.map +1 -1
- package/dist/in-store/placement-frame.js.map +1 -1
- package/dist/in-store/plate.d.ts.map +1 -1
- package/dist/in-store/plate.js +4 -0
- package/dist/in-store/plate.js.map +1 -1
- package/dist/in-store/resolve-anchor.d.ts +4 -2
- package/dist/in-store/resolve-anchor.d.ts.map +1 -1
- package/dist/in-store/resolve-anchor.js +79 -92
- package/dist/in-store/resolve-anchor.js.map +1 -1
- package/dist/in-store/resolve-source.d.ts +2 -1
- package/dist/in-store/resolve-source.d.ts.map +1 -1
- package/dist/in-store/resolve-source.js +49 -49
- package/dist/in-store/resolve-source.js.map +1 -1
- package/dist/in-store/roof.d.ts.map +1 -1
- package/dist/in-store/roof.js +4 -0
- package/dist/in-store/roof.js.map +1 -1
- package/dist/in-store/slab.d.ts.map +1 -1
- package/dist/in-store/slab.js +4 -0
- package/dist/in-store/slab.js.map +1 -1
- package/dist/in-store/space.d.ts.map +1 -1
- package/dist/in-store/space.js +4 -0
- package/dist/in-store/space.js.map +1 -1
- package/dist/in-store/spatial-children.d.ts +52 -0
- package/dist/in-store/spatial-children.d.ts.map +1 -0
- package/dist/in-store/spatial-children.js +112 -0
- package/dist/in-store/spatial-children.js.map +1 -0
- package/dist/in-store/spatial-zone.d.ts.map +1 -1
- package/dist/in-store/spatial-zone.js +5 -5
- package/dist/in-store/spatial-zone.js.map +1 -1
- package/dist/in-store/style-entity-reader.d.ts +14 -0
- package/dist/in-store/style-entity-reader.d.ts.map +1 -0
- package/dist/in-store/style-entity-reader.js +58 -0
- package/dist/in-store/style-entity-reader.js.map +1 -0
- package/dist/in-store/wall.d.ts.map +1 -1
- package/dist/in-store/wall.js +4 -14
- package/dist/in-store/wall.js.map +1 -1
- package/dist/in-store/window.d.ts.map +1 -1
- package/dist/in-store/window.js +2 -0
- package/dist/in-store/window.js.map +1 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/landxml/alignment-mapping.d.ts +98 -0
- package/dist/landxml/alignment-mapping.d.ts.map +1 -0
- package/dist/landxml/alignment-mapping.js +282 -0
- package/dist/landxml/alignment-mapping.js.map +1 -0
- package/dist/landxml/alignment-record.d.ts +18 -0
- package/dist/landxml/alignment-record.d.ts.map +1 -0
- package/dist/landxml/alignment-record.js +63 -0
- package/dist/landxml/alignment-record.js.map +1 -0
- package/dist/landxml/coordinate-plausibility.d.ts +54 -0
- package/dist/landxml/coordinate-plausibility.d.ts.map +1 -0
- package/dist/landxml/coordinate-plausibility.js +59 -0
- package/dist/landxml/coordinate-plausibility.js.map +1 -0
- package/dist/landxml/landxml-to-ifc.d.ts +45 -0
- package/dist/landxml/landxml-to-ifc.d.ts.map +1 -0
- package/dist/landxml/landxml-to-ifc.js +203 -0
- package/dist/landxml/landxml-to-ifc.js.map +1 -0
- package/dist/landxml/profile-geometry.d.ts +50 -0
- package/dist/landxml/profile-geometry.d.ts.map +1 -0
- package/dist/landxml/profile-geometry.js +221 -0
- package/dist/landxml/profile-geometry.js.map +1 -0
- package/dist/landxml/profile-mapping.d.ts +36 -0
- package/dist/landxml/profile-mapping.d.ts.map +1 -0
- package/dist/landxml/profile-mapping.js +181 -0
- package/dist/landxml/profile-mapping.js.map +1 -0
- package/dist/landxml/profile-record.d.ts +46 -0
- package/dist/landxml/profile-record.d.ts.map +1 -0
- package/dist/landxml/profile-record.js +38 -0
- package/dist/landxml/profile-record.js.map +1 -0
- package/dist/landxml/refusals.d.ts +45 -0
- package/dist/landxml/refusals.d.ts.map +1 -0
- package/dist/landxml/refusals.js +141 -0
- package/dist/landxml/refusals.js.map +1 -0
- package/dist/landxml/result-types.d.ts +78 -0
- package/dist/landxml/result-types.d.ts.map +1 -0
- package/dist/landxml/result-types.js +5 -0
- package/dist/landxml/result-types.js.map +1 -0
- package/dist/landxml/source-types.d.ts +169 -0
- package/dist/landxml/source-types.d.ts.map +1 -0
- package/dist/landxml/source-types.js +5 -0
- package/dist/landxml/source-types.js.map +1 -0
- package/dist/landxml/station-equations.d.ts +69 -0
- package/dist/landxml/station-equations.d.ts.map +1 -0
- package/dist/landxml/station-equations.js +140 -0
- package/dist/landxml/station-equations.js.map +1 -0
- package/dist/landxml/writers.d.ts +33 -0
- package/dist/landxml/writers.d.ts.map +1 -0
- package/dist/landxml/writers.js +160 -0
- package/dist/landxml/writers.js.map +1 -0
- package/dist/types.d.ts +13 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The structural view of a parsed LandXML document that the IFC mapping reads.
|
|
3
|
+
*
|
|
4
|
+
* Declared here rather than imported from the viewer on purpose: a converter
|
|
5
|
+
* that cannot be unit-tested without mounting the viewer is not a converter.
|
|
6
|
+
* The viewer's `LandXmlTinDocument` satisfies these shapes structurally, so the
|
|
7
|
+
* adaptation is a type assignment and not a translation layer that could drift.
|
|
8
|
+
*
|
|
9
|
+
* Everything the mapping refuses (§5, §11.5 of the mapping spec) appears here as an
|
|
10
|
+
* opaque `readonly unknown[]`. That is deliberate: the converter must *count and
|
|
11
|
+
* name* those records to refuse them honestly, and must not be able to read
|
|
12
|
+
* into them, which is what would let a refusal quietly become a partial export.
|
|
13
|
+
*/
|
|
14
|
+
/** A TIN vertex, in LandXML's own authored order. */
|
|
15
|
+
export interface LandXmlIfcPoint {
|
|
16
|
+
/** Document-local id, e.g. `landxml:surface:3:point:41`. Seeds the GlobalId. */
|
|
17
|
+
sourceId: string;
|
|
18
|
+
/** The `<P id="...">` attribute, which `<F>` entries reference. */
|
|
19
|
+
id: string;
|
|
20
|
+
northing: number;
|
|
21
|
+
easting: number;
|
|
22
|
+
elevation: number;
|
|
23
|
+
}
|
|
24
|
+
export interface LandXmlIfcSurface {
|
|
25
|
+
sourceId: string;
|
|
26
|
+
name: string;
|
|
27
|
+
kind: string;
|
|
28
|
+
/** Only `'rendered'` is in scope; anything else is refused by name (§5). */
|
|
29
|
+
renderState: string;
|
|
30
|
+
points: readonly LandXmlIfcPoint[];
|
|
31
|
+
/** Triples of `<P>` ids, as authored. */
|
|
32
|
+
faces: readonly (readonly [string, string, string])[];
|
|
33
|
+
/** Per-face; a `false` entry is an authored `<F i="true">`. */
|
|
34
|
+
faceVisibility?: readonly boolean[];
|
|
35
|
+
boundaries?: readonly unknown[];
|
|
36
|
+
breaklines?: readonly unknown[];
|
|
37
|
+
contours?: readonly unknown[];
|
|
38
|
+
}
|
|
39
|
+
/** A `<CgPoint>` location. `elevation` is genuinely optional in LandXML. */
|
|
40
|
+
export interface LandXmlIfcPlanPoint {
|
|
41
|
+
northing: number;
|
|
42
|
+
easting: number;
|
|
43
|
+
elevation: number | null;
|
|
44
|
+
}
|
|
45
|
+
export interface LandXmlIfcCgPoint {
|
|
46
|
+
sourceId: string;
|
|
47
|
+
name: string | null;
|
|
48
|
+
code: string | null;
|
|
49
|
+
description: string | null;
|
|
50
|
+
point: LandXmlIfcPlanPoint | null;
|
|
51
|
+
}
|
|
52
|
+
export interface LandXmlIfcPlan {
|
|
53
|
+
cogoPoints?: readonly LandXmlIfcCgPoint[];
|
|
54
|
+
monuments?: readonly unknown[];
|
|
55
|
+
planFeatures?: readonly unknown[];
|
|
56
|
+
parcels?: readonly unknown[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Units as the parser resolved them. `null` only for a source that declares
|
|
60
|
+
* none — which a renderable TIN cannot be (LXML009), so `null` here means the
|
|
61
|
+
* document carries no numeric surface at all.
|
|
62
|
+
*/
|
|
63
|
+
export interface LandXmlIfcUnits {
|
|
64
|
+
linearUnit: string;
|
|
65
|
+
elevationUnit: string;
|
|
66
|
+
linearScaleToMeters: number;
|
|
67
|
+
/** LandXML may declare a different unit for elevation than for plan. */
|
|
68
|
+
elevationScaleToMeters: number;
|
|
69
|
+
/** True when an operator supplied the unit for an undeclared source (§2.1). */
|
|
70
|
+
assumed: boolean;
|
|
71
|
+
}
|
|
72
|
+
/** A plan location: authored coordinates, or a reference to a `CgPoint` by name. */
|
|
73
|
+
export type LandXmlIfcLocation = {
|
|
74
|
+
kind: 'coordinates';
|
|
75
|
+
point: {
|
|
76
|
+
northing: number;
|
|
77
|
+
easting: number;
|
|
78
|
+
};
|
|
79
|
+
} | {
|
|
80
|
+
kind: 'point_reference';
|
|
81
|
+
pntRef: string;
|
|
82
|
+
};
|
|
83
|
+
/** `'infinite'` is LandXML's `INF` radius — a straight end of a spiral. */
|
|
84
|
+
export type LandXmlIfcRadius = number | 'infinite';
|
|
85
|
+
export type LandXmlIfcRotation = 'clockwise' | 'counter_clockwise';
|
|
86
|
+
/**
|
|
87
|
+
* One `CoordGeom` element, in the authored northing-first plan. Mirrors the
|
|
88
|
+
* viewer's `LandXmlAlignmentPrimitive` field for field, so the viewer's
|
|
89
|
+
* document assigns to this without a translation layer.
|
|
90
|
+
*/
|
|
91
|
+
export type LandXmlIfcAlignmentPrimitive = {
|
|
92
|
+
kind: 'line';
|
|
93
|
+
start: LandXmlIfcLocation;
|
|
94
|
+
end: LandXmlIfcLocation;
|
|
95
|
+
declaredLength: number | null;
|
|
96
|
+
} | {
|
|
97
|
+
kind: 'irregular_line';
|
|
98
|
+
start: LandXmlIfcLocation;
|
|
99
|
+
end: LandXmlIfcLocation;
|
|
100
|
+
declaredLength: number | null;
|
|
101
|
+
} | {
|
|
102
|
+
kind: 'curve';
|
|
103
|
+
start: LandXmlIfcLocation;
|
|
104
|
+
center: LandXmlIfcLocation;
|
|
105
|
+
end: LandXmlIfcLocation;
|
|
106
|
+
rotation: LandXmlIfcRotation;
|
|
107
|
+
radius: number | null;
|
|
108
|
+
declaredLength: number | null;
|
|
109
|
+
} | {
|
|
110
|
+
kind: 'spiral' | 'unsupported_spiral';
|
|
111
|
+
start: LandXmlIfcLocation;
|
|
112
|
+
pi: LandXmlIfcLocation;
|
|
113
|
+
end: LandXmlIfcLocation;
|
|
114
|
+
spiType: string;
|
|
115
|
+
radiusStart?: LandXmlIfcRadius;
|
|
116
|
+
radiusEnd?: LandXmlIfcRadius;
|
|
117
|
+
rotation?: LandXmlIfcRotation;
|
|
118
|
+
declaredLength: number;
|
|
119
|
+
};
|
|
120
|
+
export interface LandXmlIfcAlignmentSegment {
|
|
121
|
+
sourceId: string;
|
|
122
|
+
ordinal: number;
|
|
123
|
+
primitive: LandXmlIfcAlignmentPrimitive;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A horizontal alignment (§11). Only the horizontal geometry is read; the
|
|
127
|
+
* vertical, cant and superelevation records are counted so they can be
|
|
128
|
+
* refused by name, never read into.
|
|
129
|
+
*/
|
|
130
|
+
export interface LandXmlIfcAlignment {
|
|
131
|
+
sourceId: string;
|
|
132
|
+
name: string;
|
|
133
|
+
/** Station at the start, in the declared linear unit. */
|
|
134
|
+
staStart: number;
|
|
135
|
+
segments: readonly LandXmlIfcAlignmentSegment[];
|
|
136
|
+
profileSourceIds?: readonly string[];
|
|
137
|
+
stationEquations?: readonly unknown[];
|
|
138
|
+
cant?: unknown;
|
|
139
|
+
cantStations?: readonly unknown[];
|
|
140
|
+
superelevations?: readonly unknown[];
|
|
141
|
+
}
|
|
142
|
+
export interface LandXmlIfcSource {
|
|
143
|
+
schema: string;
|
|
144
|
+
version: string;
|
|
145
|
+
units: LandXmlIfcUnits | null;
|
|
146
|
+
coordinateSystem?: {
|
|
147
|
+
horizontalDatum?: string;
|
|
148
|
+
verticalDatum?: string;
|
|
149
|
+
};
|
|
150
|
+
surfaces: readonly LandXmlIfcSurface[];
|
|
151
|
+
/**
|
|
152
|
+
* Horizontal alignments. Typed `unknown[]` on purpose: v1.0 published this
|
|
153
|
+
* field as opaque, and narrowing an input type is a breaking change (#5370
|
|
154
|
+
* review). Each record is checked at run time instead — `isAlignmentRecord`
|
|
155
|
+
* in `alignment-mapping.ts` — and one that is not a `LandXmlIfcAlignment` is
|
|
156
|
+
* refused by name, never read into. The viewer's parsed document satisfies
|
|
157
|
+
* `LandXmlIfcAlignment`; that is the shape to produce.
|
|
158
|
+
*/
|
|
159
|
+
alignments?: readonly unknown[];
|
|
160
|
+
profiles?: readonly unknown[];
|
|
161
|
+
crossSections?: readonly unknown[];
|
|
162
|
+
crossSectionSurfaces?: readonly unknown[];
|
|
163
|
+
roadways?: readonly unknown[];
|
|
164
|
+
plan?: LandXmlIfcPlan;
|
|
165
|
+
pipeNetworks?: {
|
|
166
|
+
networks?: readonly unknown[];
|
|
167
|
+
} | null;
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=source-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1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,GAAG,IAAI,CAAC;IAC9B,gBAAgB,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxE,QAAQ,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACvC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC9B,aAAa,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACnC,oBAAoB,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC1C,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,YAAY,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAA;KAAE,GAAG,IAAI,CAAC;CACzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-types.js","sourceRoot":"","sources":["../../src/landxml/source-types.ts"],"names":[],"mappings":"AAAA;;+DAE+D"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LandXML `StaEquation` → `IfcReferent` / `Pset_Stationing` parameters
|
|
3
|
+
* (mapping spec §14).
|
|
4
|
+
*
|
|
5
|
+
* Pure numbers, like `alignment-mapping.ts`: the export dialog's pre-flight
|
|
6
|
+
* and the export itself run this same function, so the refusal the dialog
|
|
7
|
+
* shows is the refusal the export gives.
|
|
8
|
+
*
|
|
9
|
+
* An alignment's equations are mapped ALL OR NONE (§14.2). Stationing is
|
|
10
|
+
* cumulative, so writing some and dropping one would make every station after
|
|
11
|
+
* the dropped one wrong in a file that looks complete.
|
|
12
|
+
*/
|
|
13
|
+
import { type AlignmentMapping, type MappedAlignment } from './alignment-mapping.js';
|
|
14
|
+
import type { LandXmlIfcAlignment, LandXmlIfcSource, LandXmlIfcUnits } from './source-types.js';
|
|
15
|
+
/**
|
|
16
|
+
* A `StaEquation` as the parser delivers it. `LandXmlIfcAlignment.stationEquations`
|
|
17
|
+
* stays `unknown[]` (narrowing a published input type is a breaking change), so
|
|
18
|
+
* each record is checked against this shape at run time instead.
|
|
19
|
+
*/
|
|
20
|
+
export interface LandXmlIfcStationEquation {
|
|
21
|
+
sourceId: string;
|
|
22
|
+
/** Where, in the alignment's continuous stationing (`staStart` + distance along). */
|
|
23
|
+
staInternal: number;
|
|
24
|
+
/** The station from here on. */
|
|
25
|
+
staAhead: number;
|
|
26
|
+
/** The station arriving here, when authored. */
|
|
27
|
+
staBack: number | null;
|
|
28
|
+
/** `'increasing'` / `'decreasing'` — the direction of stationing after this point. */
|
|
29
|
+
staIncrement: string | null;
|
|
30
|
+
}
|
|
31
|
+
/** One station equation, in metres, ready for `Pset_Stationing`. */
|
|
32
|
+
export interface MappedStationEquation {
|
|
33
|
+
sourceId: string;
|
|
34
|
+
/** Distance along the alignment's basis curve from its start. */
|
|
35
|
+
distanceAlong: number;
|
|
36
|
+
/** `Pset_Stationing.Station` — the ahead station. */
|
|
37
|
+
station: number;
|
|
38
|
+
/** `Pset_Stationing.IncomingStation` — authored `staBack`, or derived (§14.1). */
|
|
39
|
+
incomingStation: number;
|
|
40
|
+
/** `Pset_Stationing.HasIncreasingStation`; `null` when `staIncrement` was not authored. */
|
|
41
|
+
increasing: boolean | null;
|
|
42
|
+
}
|
|
43
|
+
export interface StationEquationMapping {
|
|
44
|
+
/** Written equations, in order along the alignment. Empty when refused. */
|
|
45
|
+
equations: MappedStationEquation[];
|
|
46
|
+
/** How many equations the source carries on this alignment. */
|
|
47
|
+
count: number;
|
|
48
|
+
/** Why they were all refused, or `null` when they are written. */
|
|
49
|
+
refusal: string | null;
|
|
50
|
+
}
|
|
51
|
+
/** Map one WRITTEN alignment's station equations, all or none (§14.2). */
|
|
52
|
+
export declare function mapStationEquations(record: LandXmlIfcAlignment, alignment: MappedAlignment, units: LandXmlIfcUnits): StationEquationMapping;
|
|
53
|
+
/**
|
|
54
|
+
* The station-equation mapping of every WRITTEN alignment, by source id. A
|
|
55
|
+
* refused alignment takes its equations with it and is absent here: counting
|
|
56
|
+
* them again would misstate what is missing.
|
|
57
|
+
*/
|
|
58
|
+
export declare function stationEquationsOf(source: LandXmlIfcSource, alignmentMapping: AlignmentMapping): Map<string, StationEquationMapping>;
|
|
59
|
+
/**
|
|
60
|
+
* Every distance along the alignment at which the DISPLAYED `station` (metres)
|
|
61
|
+
* occurs, given its written station equations — `rust/landxml`'s
|
|
62
|
+
* `distances_for_station`, over the mapped (metre) values.
|
|
63
|
+
*
|
|
64
|
+
* Empty: the station falls in a forward jump's gap. More than one: a backward
|
|
65
|
+
* jump (or a change of direction) displays it twice. Only exactly one is a
|
|
66
|
+
* place (§12.2, §14.5).
|
|
67
|
+
*/
|
|
68
|
+
export declare function distancesForStation(station: number, startStation: number, equations: readonly MappedStationEquation[], length: number): number[];
|
|
69
|
+
//# sourceMappingURL=station-equations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"station-equations.d.ts","sourceRoot":"","sources":["../../src/landxml/station-equations.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAC8C,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAC/F,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEhG;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,sFAAsF;IACtF,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,oEAAoE;AACpE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,eAAe,EAAE,MAAM,CAAC;IACxB,2FAA2F;IAC3F,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,2EAA2E;IAC3E,SAAS,EAAE,qBAAqB,EAAE,CAAC;IACnC,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAsED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAC9E,sBAAsB,CASxB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,GAC3D,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAYrC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,qBAAqB,EAAE,EAAE,MAAM,EAAE,MAAM,GACjG,MAAM,EAAE,CAcV"}
|
|
@@ -0,0 +1,140 @@
|
|
|
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
|
+
* LandXML `StaEquation` → `IfcReferent` / `Pset_Stationing` parameters
|
|
6
|
+
* (mapping spec §14).
|
|
7
|
+
*
|
|
8
|
+
* Pure numbers, like `alignment-mapping.ts`: the export dialog's pre-flight
|
|
9
|
+
* and the export itself run this same function, so the refusal the dialog
|
|
10
|
+
* shows is the refusal the export gives.
|
|
11
|
+
*
|
|
12
|
+
* An alignment's equations are mapped ALL OR NONE (§14.2). Stationing is
|
|
13
|
+
* cumulative, so writing some and dropping one would make every station after
|
|
14
|
+
* the dropped one wrong in a file that looks complete.
|
|
15
|
+
*/
|
|
16
|
+
import { ALIGNMENT_POSITION_TOLERANCE_M, isAlignmentRecord, } from './alignment-mapping.js';
|
|
17
|
+
class Refusal extends Error {
|
|
18
|
+
}
|
|
19
|
+
function refuse(message) {
|
|
20
|
+
throw new Refusal(message);
|
|
21
|
+
}
|
|
22
|
+
const finite = (value) => typeof value === 'number' && Number.isFinite(value);
|
|
23
|
+
function checkRecord(value, label) {
|
|
24
|
+
const record = (typeof value === 'object' && value !== null ? value : {});
|
|
25
|
+
const increment = record.staIncrement;
|
|
26
|
+
if (typeof record.sourceId !== 'string' || !finite(record.staInternal) || !finite(record.staAhead)
|
|
27
|
+
|| !(record.staBack === null || record.staBack === undefined || finite(record.staBack))
|
|
28
|
+
|| !(increment === null || increment === undefined || increment === 'increasing' || increment === 'decreasing')) {
|
|
29
|
+
refuse(`${label} is not a station-equation record (it needs a finite staInternal and staAhead, `
|
|
30
|
+
+ 'and a finite staBack and an increasing/decreasing staIncrement where given)');
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
sourceId: record.sourceId,
|
|
34
|
+
staInternal: record.staInternal,
|
|
35
|
+
staAhead: record.staAhead,
|
|
36
|
+
staBack: finite(record.staBack) ? record.staBack : null,
|
|
37
|
+
staIncrement: typeof increment === 'string' ? increment : null,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function mapAll(records, alignment, units) {
|
|
41
|
+
const scale = units.linearScaleToMeters;
|
|
42
|
+
const length = alignment.segments.reduce((total, segment) => total + segment.length, 0);
|
|
43
|
+
const out = [];
|
|
44
|
+
// The running stationing, exactly as `rust/landxml`'s `station_mapping`
|
|
45
|
+
// walks it: the display value and direction in force since the last equation.
|
|
46
|
+
let previousDistance = 0;
|
|
47
|
+
let displayed = alignment.startStation;
|
|
48
|
+
let direction = 1;
|
|
49
|
+
records.forEach((value, index) => {
|
|
50
|
+
const label = `station equation ${index + 1}`;
|
|
51
|
+
const equation = checkRecord(value, label);
|
|
52
|
+
const distanceAlong = equation.staInternal * scale - alignment.startStation;
|
|
53
|
+
if (distanceAlong <= ALIGNMENT_POSITION_TOLERANCE_M) {
|
|
54
|
+
refuse(`${label} is at internal station ${equation.staInternal}, at or before the alignment's start`);
|
|
55
|
+
}
|
|
56
|
+
if (distanceAlong > length + ALIGNMENT_POSITION_TOLERANCE_M) {
|
|
57
|
+
refuse(`${label} is ${(distanceAlong - length).toFixed(3)} m beyond the alignment's end`);
|
|
58
|
+
}
|
|
59
|
+
if (index > 0 && distanceAlong <= previousDistance) {
|
|
60
|
+
refuse(`${label} is not after station equation ${index} along the alignment`);
|
|
61
|
+
}
|
|
62
|
+
const along = Math.min(distanceAlong, length);
|
|
63
|
+
const incomingStation = equation.staBack !== null
|
|
64
|
+
? equation.staBack * scale
|
|
65
|
+
: displayed + direction * (along - previousDistance);
|
|
66
|
+
out.push({
|
|
67
|
+
sourceId: equation.sourceId,
|
|
68
|
+
distanceAlong: along,
|
|
69
|
+
station: equation.staAhead * scale,
|
|
70
|
+
incomingStation,
|
|
71
|
+
increasing: equation.staIncrement === null ? null : equation.staIncrement === 'increasing',
|
|
72
|
+
});
|
|
73
|
+
previousDistance = along;
|
|
74
|
+
displayed = equation.staAhead * scale;
|
|
75
|
+
direction = equation.staIncrement === 'decreasing' ? -1 : 1;
|
|
76
|
+
});
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
/** Map one WRITTEN alignment's station equations, all or none (§14.2). */
|
|
80
|
+
export function mapStationEquations(record, alignment, units) {
|
|
81
|
+
const records = record.stationEquations ?? [];
|
|
82
|
+
if (records.length === 0)
|
|
83
|
+
return { equations: [], count: 0, refusal: null };
|
|
84
|
+
try {
|
|
85
|
+
return { equations: mapAll(records, alignment, units), count: records.length, refusal: null };
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
if (!(error instanceof Refusal))
|
|
89
|
+
throw error;
|
|
90
|
+
return { equations: [], count: records.length, refusal: error.message };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The station-equation mapping of every WRITTEN alignment, by source id. A
|
|
95
|
+
* refused alignment takes its equations with it and is absent here: counting
|
|
96
|
+
* them again would misstate what is missing.
|
|
97
|
+
*/
|
|
98
|
+
export function stationEquationsOf(source, alignmentMapping) {
|
|
99
|
+
const out = new Map();
|
|
100
|
+
if (source.units === null)
|
|
101
|
+
return out;
|
|
102
|
+
const records = new Map();
|
|
103
|
+
for (const candidate of source.alignments ?? []) {
|
|
104
|
+
if (isAlignmentRecord(candidate) && !records.has(candidate.sourceId))
|
|
105
|
+
records.set(candidate.sourceId, candidate);
|
|
106
|
+
}
|
|
107
|
+
for (const alignment of alignmentMapping.mapped) {
|
|
108
|
+
const record = records.get(alignment.sourceId);
|
|
109
|
+
if (record)
|
|
110
|
+
out.set(alignment.sourceId, mapStationEquations(record, alignment, source.units));
|
|
111
|
+
}
|
|
112
|
+
return out;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Every distance along the alignment at which the DISPLAYED `station` (metres)
|
|
116
|
+
* occurs, given its written station equations — `rust/landxml`'s
|
|
117
|
+
* `distances_for_station`, over the mapped (metre) values.
|
|
118
|
+
*
|
|
119
|
+
* Empty: the station falls in a forward jump's gap. More than one: a backward
|
|
120
|
+
* jump (or a change of direction) displays it twice. Only exactly one is a
|
|
121
|
+
* place (§12.2, §14.5).
|
|
122
|
+
*/
|
|
123
|
+
export function distancesForStation(station, startStation, equations, length) {
|
|
124
|
+
const tolerance = ALIGNMENT_POSITION_TOLERANCE_M;
|
|
125
|
+
const boundaries = [0, ...equations.map((equation) => equation.distanceAlong), length];
|
|
126
|
+
const out = [];
|
|
127
|
+
for (let index = 0; index + 1 < boundaries.length; index += 1) {
|
|
128
|
+
const previous = index === 0 ? null : equations[index - 1];
|
|
129
|
+
const displayStart = previous ? previous.station : startStation;
|
|
130
|
+
const direction = previous?.increasing === false ? -1 : 1;
|
|
131
|
+
const candidate = boundaries[index] + (station - displayStart) / direction;
|
|
132
|
+
if (candidate < boundaries[index] - tolerance || candidate > boundaries[index + 1] + tolerance)
|
|
133
|
+
continue;
|
|
134
|
+
const distance = Math.min(Math.max(candidate, 0), length);
|
|
135
|
+
if (out.length === 0 || Math.abs(distance - out[out.length - 1]) > tolerance)
|
|
136
|
+
out.push(distance);
|
|
137
|
+
}
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=station-equations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"station-equations.js","sourceRoot":"","sources":["../../src/landxml/station-equations.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,8BAA8B,EAAE,iBAAiB,GAClD,MAAM,wBAAwB,CAAC;AA0ChC,MAAM,OAAQ,SAAQ,KAAK;CAAG;AAE9B,SAAS,MAAM,CAAC,OAAe;IAC7B,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,MAAM,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAExG,SAAS,WAAW,CAAC,KAAc,EAAE,KAAa;IAChD,MAAM,MAAM,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAA4B,CAAC;IACrG,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC;IACtC,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,IA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D,MAAM,YAAY,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC;QAChE,MAAM,SAAS,GAAG,QAAQ,EAAE,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,YAAY,CAAC,GAAG,SAAS,CAAC;QAC3E,IAAI,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,SAAS,IAAI,SAAS,GAAG,UAAU,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,SAAS;YAAE,SAAS;QACzG,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAC1D,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS;YAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnG,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-record writers `landXmlToIfc` composes: TIN surfaces, survey points
|
|
3
|
+
* and alignments. Split out of `landxml-to-ifc.ts` so the orchestrator reads
|
|
4
|
+
* as the sequence it is — refuse, warn, write, record provenance — and each
|
|
5
|
+
* record family's conversion can be read on its own.
|
|
6
|
+
*
|
|
7
|
+
* `toIfcVertex` is the one place a surface or survey point's axes are
|
|
8
|
+
* reordered (alignments do theirs in `alignment-mapping.ts`'s `planPoint`).
|
|
9
|
+
*/
|
|
10
|
+
import type { TerrainWriter } from '../ifc-creator-terrain.js';
|
|
11
|
+
import type { MappedAlignment } from './alignment-mapping.js';
|
|
12
|
+
import type { MappedProfile } from './profile-mapping.js';
|
|
13
|
+
import type { StationEquationMapping } from './station-equations.js';
|
|
14
|
+
import type { LandXmlIfcCgPoint, LandXmlIfcSurface, LandXmlIfcUnits } from './source-types.js';
|
|
15
|
+
/** Deterministic GlobalId from a LandXML source id, passed in to avoid an import cycle. */
|
|
16
|
+
export type GlobalIdOf = (sourceId: string) => string;
|
|
17
|
+
export declare function writeSurfaces(terrain: TerrainWriter, surfaces: readonly LandXmlIfcSurface[], units: LandXmlIfcUnits, swap: boolean, landXmlGlobalId: GlobalIdOf): {
|
|
18
|
+
surfaces: number;
|
|
19
|
+
vertices: number;
|
|
20
|
+
triangles: number;
|
|
21
|
+
samples: Array<[number, number]>;
|
|
22
|
+
};
|
|
23
|
+
export declare function writeSurveyPoints(terrain: TerrainWriter, points: readonly LandXmlIfcCgPoint[], units: LandXmlIfcUnits, swap: boolean, landXmlGlobalId: GlobalIdOf): {
|
|
24
|
+
count: number;
|
|
25
|
+
samples: Array<[number, number]>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Write each mapped alignment (§11). GlobalIds derive from the alignment's
|
|
29
|
+
* source id and the role of each owned entity, so a re-export of an unchanged
|
|
30
|
+
* alignment is byte-identical (§4.3).
|
|
31
|
+
*/
|
|
32
|
+
export declare function writeAlignments(terrain: TerrainWriter, alignments: readonly MappedAlignment[], landXmlGlobalId: GlobalIdOf, profiles?: readonly MappedProfile[], stationing?: ReadonlyMap<string, StationEquationMapping>): Array<[number, number]>;
|
|
33
|
+
//# sourceMappingURL=writers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writers.d.ts","sourceRoot":"","sources":["../../src/landxml/writers.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM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1,160 @@
|
|
|
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 { isMappableSurface } from './refusals.js';
|
|
5
|
+
/**
|
|
6
|
+
* LandXML's authored `(northing, easting, elevation)` → IFC's
|
|
7
|
+
* `(X, Y, Z) = (easting, northing, elevation)`, in metres.
|
|
8
|
+
*
|
|
9
|
+
* The one place the axes are reordered. `swap` is the operator's confirmed
|
|
10
|
+
* override for a producer that wrote its point text easting-first; it reverses
|
|
11
|
+
* this function's own swap, so a swapped source and an unswapped one produce
|
|
12
|
+
* the same IFC.
|
|
13
|
+
*/
|
|
14
|
+
function toIfcVertex(northing, easting, elevation, units, swap) {
|
|
15
|
+
const plan = units.linearScaleToMeters;
|
|
16
|
+
const [x, y] = swap ? [northing, easting] : [easting, northing];
|
|
17
|
+
return [x * plan, y * plan, elevation * units.elevationScaleToMeters];
|
|
18
|
+
}
|
|
19
|
+
function surfaceVertices(surface, units, swap) {
|
|
20
|
+
const coordinates = [];
|
|
21
|
+
const indexById = new Map();
|
|
22
|
+
for (const point of surface.points) {
|
|
23
|
+
// `CoordIndex` is 1-based, so the index recorded here is `length` *after*
|
|
24
|
+
// the push — not before.
|
|
25
|
+
coordinates.push(toIfcVertex(point.northing, point.easting, point.elevation, units, swap));
|
|
26
|
+
// First writer wins on a duplicate `<P id>`: a later duplicate would
|
|
27
|
+
// silently repoint every face authored against the earlier one.
|
|
28
|
+
if (!indexById.has(point.id))
|
|
29
|
+
indexById.set(point.id, coordinates.length);
|
|
30
|
+
}
|
|
31
|
+
return { coordinates, indexById };
|
|
32
|
+
}
|
|
33
|
+
function surfaceTriangles(surface, indexById) {
|
|
34
|
+
const visibility = surface.faceVisibility;
|
|
35
|
+
const triangles = [];
|
|
36
|
+
surface.faces.forEach((face, ordinal) => {
|
|
37
|
+
// An authored `<F i="true">` is a hidden face: it is part of the source
|
|
38
|
+
// record but draws nothing, and writing it would add a triangle the source
|
|
39
|
+
// says is not there.
|
|
40
|
+
if (visibility && visibility[ordinal] === false)
|
|
41
|
+
return;
|
|
42
|
+
const resolved = face.map((pointId) => indexById.get(pointId));
|
|
43
|
+
if (resolved.some((index) => index === undefined)) {
|
|
44
|
+
throw new Error(`landXmlToIfc: surface '${surface.name}' face ${ordinal} references point id `
|
|
45
|
+
+ `'${face.find((id) => !indexById.has(id))}', which the surface does not define`);
|
|
46
|
+
}
|
|
47
|
+
triangles.push(resolved);
|
|
48
|
+
});
|
|
49
|
+
return triangles;
|
|
50
|
+
}
|
|
51
|
+
/** Non-empty text properties of one CgPoint, in a stable order. */
|
|
52
|
+
function surveyProperties(point, location) {
|
|
53
|
+
const entries = [
|
|
54
|
+
{ Name: 'SourceId', Value: point.sourceId },
|
|
55
|
+
];
|
|
56
|
+
if (point.name)
|
|
57
|
+
entries.push({ Name: 'Name', Value: point.name });
|
|
58
|
+
if (point.code)
|
|
59
|
+
entries.push({ Name: 'Code', Value: point.code });
|
|
60
|
+
if (point.description)
|
|
61
|
+
entries.push({ Name: 'Description', Value: point.description });
|
|
62
|
+
entries.push({ Name: 'Easting', Value: String(location[0]) }, { Name: 'Northing', Value: String(location[1]) });
|
|
63
|
+
// A 2D CgPoint is placed at Z = 0 because a placement needs a number, but
|
|
64
|
+
// the property set must not claim an elevation the source never authored.
|
|
65
|
+
if (point.point?.elevation !== null && point.point?.elevation !== undefined) {
|
|
66
|
+
entries.push({ Name: 'Elevation', Value: String(location[2]) });
|
|
67
|
+
}
|
|
68
|
+
return entries;
|
|
69
|
+
}
|
|
70
|
+
export function writeSurfaces(terrain, surfaces, units, swap, landXmlGlobalId) {
|
|
71
|
+
let written = 0;
|
|
72
|
+
let vertices = 0;
|
|
73
|
+
let triangles = 0;
|
|
74
|
+
const samples = [];
|
|
75
|
+
for (const surface of surfaces) {
|
|
76
|
+
if (!isMappableSurface(surface))
|
|
77
|
+
continue;
|
|
78
|
+
const { coordinates, indexById } = surfaceVertices(surface, units, swap);
|
|
79
|
+
const faces = surfaceTriangles(surface, indexById);
|
|
80
|
+
// Unreachable for an all-hidden surface — `isMappableSurface` refuses it by
|
|
81
|
+
// name first. Kept as a guard because CoordIndex is LIST [1:?].
|
|
82
|
+
if (faces.length === 0)
|
|
83
|
+
continue;
|
|
84
|
+
terrain.addSurface({
|
|
85
|
+
Name: surface.name,
|
|
86
|
+
GlobalId: landXmlGlobalId(surface.sourceId),
|
|
87
|
+
Coordinates: coordinates,
|
|
88
|
+
Triangles: faces,
|
|
89
|
+
});
|
|
90
|
+
written += 1;
|
|
91
|
+
vertices += coordinates.length;
|
|
92
|
+
triangles += faces.length;
|
|
93
|
+
for (const [x, y] of coordinates)
|
|
94
|
+
samples.push([x, y]);
|
|
95
|
+
}
|
|
96
|
+
return { surfaces: written, vertices, triangles, samples };
|
|
97
|
+
}
|
|
98
|
+
export function writeSurveyPoints(terrain, points, units, swap, landXmlGlobalId) {
|
|
99
|
+
let count = 0;
|
|
100
|
+
const samples = [];
|
|
101
|
+
for (const point of points) {
|
|
102
|
+
// A CgPoint may carry only a `pntRef`, with no coordinates of its own.
|
|
103
|
+
// `collectRefusals` names those as `unlocated-cgpoints`.
|
|
104
|
+
if (!point.point)
|
|
105
|
+
continue;
|
|
106
|
+
const location = toIfcVertex(point.point.northing, point.point.easting, point.point.elevation ?? 0, units, swap);
|
|
107
|
+
const annotationId = terrain.addSurveyPoint({
|
|
108
|
+
Name: point.name,
|
|
109
|
+
Description: point.description,
|
|
110
|
+
GlobalId: landXmlGlobalId(point.sourceId),
|
|
111
|
+
Location: location,
|
|
112
|
+
});
|
|
113
|
+
terrain.addPropertySet(annotationId, {
|
|
114
|
+
Name: 'LandXML_CgPoint',
|
|
115
|
+
GlobalId: landXmlGlobalId(`${point.sourceId}:pset`),
|
|
116
|
+
Properties: surveyProperties(point, location),
|
|
117
|
+
});
|
|
118
|
+
count += 1;
|
|
119
|
+
samples.push([location[0], location[1]]);
|
|
120
|
+
}
|
|
121
|
+
return { count, samples };
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Write each mapped alignment (§11). GlobalIds derive from the alignment's
|
|
125
|
+
* source id and the role of each owned entity, so a re-export of an unchanged
|
|
126
|
+
* alignment is byte-identical (§4.3).
|
|
127
|
+
*/
|
|
128
|
+
export function writeAlignments(terrain, alignments, landXmlGlobalId, profiles = [], stationing = new Map()) {
|
|
129
|
+
const samples = [];
|
|
130
|
+
for (const alignment of alignments) {
|
|
131
|
+
// At most one: `mapProfiles` refuses every design profile of an alignment
|
|
132
|
+
// that has more than one (§12.2).
|
|
133
|
+
const profile = profiles.find((candidate) => candidate.alignmentSourceId === alignment.sourceId);
|
|
134
|
+
terrain.addAlignment({
|
|
135
|
+
...(profile ? {
|
|
136
|
+
Vertical: { Name: profile.name, GlobalId: landXmlGlobalId(profile.sourceId), Segments: profile.segments },
|
|
137
|
+
} : {}),
|
|
138
|
+
Name: alignment.name,
|
|
139
|
+
GlobalId: landXmlGlobalId(alignment.sourceId),
|
|
140
|
+
StartStation: alignment.startStation,
|
|
141
|
+
Segments: alignment.segments,
|
|
142
|
+
// §14: each written equation is an IfcReferent whose GlobalId derives
|
|
143
|
+
// from the equation's own source id.
|
|
144
|
+
StationEquations: (stationing.get(alignment.sourceId)?.equations ?? []).map((equation) => ({
|
|
145
|
+
DistanceAlong: equation.distanceAlong,
|
|
146
|
+
Station: equation.station,
|
|
147
|
+
IncomingStation: equation.incomingStation,
|
|
148
|
+
HasIncreasingStation: equation.increasing,
|
|
149
|
+
Role: equation.sourceId.startsWith(`${alignment.sourceId}:`)
|
|
150
|
+
? equation.sourceId.slice(alignment.sourceId.length + 1)
|
|
151
|
+
: equation.sourceId,
|
|
152
|
+
})),
|
|
153
|
+
guidFor: (role) => landXmlGlobalId(`${alignment.sourceId}:${role}`),
|
|
154
|
+
});
|
|
155
|
+
for (const segment of alignment.segments)
|
|
156
|
+
samples.push([segment.start[0], segment.start[1]]);
|
|
157
|
+
}
|
|
158
|
+
return samples;
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=writers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writers.js","sourceRoot":"","sources":["../../src/landxml/writers.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAa/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AASlD;;;;;;;;GAQG;AACH,SAAS,WAAW,CAClB,QAAgB,EAAE,OAAe,EAAE,SAAiB,EAAE,KAAsB,EAAE,IAAa;IAE3F,MAAM,IAAI,GAAG,KAAK,CAAC,mBAAmB,CAAC;IACvC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChE,OAAO,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,KAAK,CAAC,sBAAsB,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,eAAe,CACtB,OAA0B,EAAE,KAAsB,EAAE,IAAa;IAEjE,MAAM,WAAW,GAAoC,EAAE,CAAC;IACxD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnC,0EAA0E;QAC1E,yBAAyB;QACzB,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QAC3F,qEAAqE;QACrE,gEAAgE;QAChE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YAAE,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE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F,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -414,12 +414,23 @@ export interface ProxyParams extends ElementAttributes {
|
|
|
414
414
|
ProxyType?: string;
|
|
415
415
|
}
|
|
416
416
|
/** IFC property value types */
|
|
417
|
-
|
|
417
|
+
/**
|
|
418
|
+
* A numeric measure type -- `IfcThermalTransmittanceMeasure`,
|
|
419
|
+
* `IfcPositiveLengthMeasure`, `IfcCountMeasure`, `IfcPlaneAngleMeasure`, ...
|
|
420
|
+
* Standard property sets declare their values in these (Pset_WallCommon's
|
|
421
|
+
* ThermalTransmittance is an IfcThermalTransmittanceMeasure, not an IfcReal),
|
|
422
|
+
* and an IDS check on the data type fails a value written as the wrong one.
|
|
423
|
+
*/
|
|
424
|
+
export type PropertyMeasureType = `Ifc${string}Measure`;
|
|
425
|
+
export type PropertyType = 'IfcLabel' | 'IfcText' | 'IfcIdentifier' | 'IfcReal' | 'IfcInteger' | 'IfcBoolean' | 'IfcLogical' | PropertyMeasureType;
|
|
418
426
|
/** Single property definition */
|
|
419
427
|
export interface PropertyDef {
|
|
420
428
|
Name: string;
|
|
421
429
|
NominalValue: string | number | boolean;
|
|
422
|
-
/**
|
|
430
|
+
/**
|
|
431
|
+
* Defaults to IfcLabel for strings, IfcInteger/IfcReal for numbers, IfcBoolean
|
|
432
|
+
* for booleans. A numeric value may declare any measure type and is written as it.
|
|
433
|
+
*/
|
|
423
434
|
Type?: PropertyType;
|
|
424
435
|
}
|
|
425
436
|
/** Property set to attach to an element */
|