@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.
Files changed (159) hide show
  1. package/README.md +7 -0
  2. package/dist/ifc-creator-alignment-referents.d.ts +35 -0
  3. package/dist/ifc-creator-alignment-referents.d.ts.map +1 -0
  4. package/dist/ifc-creator-alignment-referents.js +89 -0
  5. package/dist/ifc-creator-alignment-referents.js.map +1 -0
  6. package/dist/ifc-creator-alignment-vertical.d.ts +40 -0
  7. package/dist/ifc-creator-alignment-vertical.d.ts.map +1 -0
  8. package/dist/ifc-creator-alignment-vertical.js +182 -0
  9. package/dist/ifc-creator-alignment-vertical.js.map +1 -0
  10. package/dist/ifc-creator-alignment.d.ts +45 -0
  11. package/dist/ifc-creator-alignment.d.ts.map +1 -0
  12. package/dist/ifc-creator-alignment.js +173 -0
  13. package/dist/ifc-creator-alignment.js.map +1 -0
  14. package/dist/ifc-creator-header.d.ts +2 -0
  15. package/dist/ifc-creator-header.d.ts.map +1 -0
  16. package/dist/ifc-creator-header.js +22 -0
  17. package/dist/ifc-creator-header.js.map +1 -0
  18. package/dist/ifc-creator-math.d.ts +37 -5
  19. package/dist/ifc-creator-math.d.ts.map +1 -1
  20. package/dist/ifc-creator-math.js +93 -4
  21. package/dist/ifc-creator-math.js.map +1 -1
  22. package/dist/ifc-creator-relationships.d.ts +43 -0
  23. package/dist/ifc-creator-relationships.d.ts.map +1 -0
  24. package/dist/ifc-creator-relationships.js +38 -0
  25. package/dist/ifc-creator-relationships.js.map +1 -0
  26. package/dist/ifc-creator-styles.d.ts +22 -0
  27. package/dist/ifc-creator-styles.d.ts.map +1 -0
  28. package/dist/ifc-creator-styles.js +50 -0
  29. package/dist/ifc-creator-styles.js.map +1 -0
  30. package/dist/ifc-creator-terrain.d.ts +170 -0
  31. package/dist/ifc-creator-terrain.d.ts.map +1 -0
  32. package/dist/ifc-creator-terrain.js +180 -0
  33. package/dist/ifc-creator-terrain.js.map +1 -0
  34. package/dist/ifc-creator.d.ts +21 -7
  35. package/dist/ifc-creator.d.ts.map +1 -1
  36. package/dist/ifc-creator.js +93 -97
  37. package/dist/ifc-creator.js.map +1 -1
  38. package/dist/in-store/_emit-helpers.d.ts +2 -1
  39. package/dist/in-store/_emit-helpers.d.ts.map +1 -1
  40. package/dist/in-store/_emit-helpers.js +7 -7
  41. package/dist/in-store/_emit-helpers.js.map +1 -1
  42. package/dist/in-store/anchor.d.ts +2 -0
  43. package/dist/in-store/anchor.d.ts.map +1 -1
  44. package/dist/in-store/anchor.js.map +1 -1
  45. package/dist/in-store/apply-style.d.ts +3 -6
  46. package/dist/in-store/apply-style.d.ts.map +1 -1
  47. package/dist/in-store/apply-style.js +3 -77
  48. package/dist/in-store/apply-style.js.map +1 -1
  49. package/dist/in-store/column.d.ts.map +1 -1
  50. package/dist/in-store/column.js +2 -0
  51. package/dist/in-store/column.js.map +1 -1
  52. package/dist/in-store/door.d.ts.map +1 -1
  53. package/dist/in-store/door.js +2 -0
  54. package/dist/in-store/door.js.map +1 -1
  55. package/dist/in-store/extract-walls.d.ts +1 -1
  56. package/dist/in-store/extract-walls.d.ts.map +1 -1
  57. package/dist/in-store/extract-walls.js +37 -55
  58. package/dist/in-store/extract-walls.js.map +1 -1
  59. package/dist/in-store/generate-spaces-all.d.ts +6 -2
  60. package/dist/in-store/generate-spaces-all.d.ts.map +1 -1
  61. package/dist/in-store/generate-spaces-all.js +33 -9
  62. package/dist/in-store/generate-spaces-all.js.map +1 -1
  63. package/dist/in-store/generate-spaces.js +1 -1
  64. package/dist/in-store/generate-spaces.js.map +1 -1
  65. package/dist/in-store/placement-frame.d.ts +8 -0
  66. package/dist/in-store/placement-frame.d.ts.map +1 -1
  67. package/dist/in-store/placement-frame.js.map +1 -1
  68. package/dist/in-store/plate.d.ts.map +1 -1
  69. package/dist/in-store/plate.js +4 -0
  70. package/dist/in-store/plate.js.map +1 -1
  71. package/dist/in-store/resolve-anchor.d.ts +4 -2
  72. package/dist/in-store/resolve-anchor.d.ts.map +1 -1
  73. package/dist/in-store/resolve-anchor.js +79 -92
  74. package/dist/in-store/resolve-anchor.js.map +1 -1
  75. package/dist/in-store/resolve-source.d.ts +2 -1
  76. package/dist/in-store/resolve-source.d.ts.map +1 -1
  77. package/dist/in-store/resolve-source.js +49 -49
  78. package/dist/in-store/resolve-source.js.map +1 -1
  79. package/dist/in-store/roof.d.ts.map +1 -1
  80. package/dist/in-store/roof.js +4 -0
  81. package/dist/in-store/roof.js.map +1 -1
  82. package/dist/in-store/slab.d.ts.map +1 -1
  83. package/dist/in-store/slab.js +4 -0
  84. package/dist/in-store/slab.js.map +1 -1
  85. package/dist/in-store/space.d.ts.map +1 -1
  86. package/dist/in-store/space.js +4 -0
  87. package/dist/in-store/space.js.map +1 -1
  88. package/dist/in-store/spatial-children.d.ts +52 -0
  89. package/dist/in-store/spatial-children.d.ts.map +1 -0
  90. package/dist/in-store/spatial-children.js +112 -0
  91. package/dist/in-store/spatial-children.js.map +1 -0
  92. package/dist/in-store/spatial-zone.d.ts.map +1 -1
  93. package/dist/in-store/spatial-zone.js +5 -5
  94. package/dist/in-store/spatial-zone.js.map +1 -1
  95. package/dist/in-store/style-entity-reader.d.ts +14 -0
  96. package/dist/in-store/style-entity-reader.d.ts.map +1 -0
  97. package/dist/in-store/style-entity-reader.js +58 -0
  98. package/dist/in-store/style-entity-reader.js.map +1 -0
  99. package/dist/in-store/wall.d.ts.map +1 -1
  100. package/dist/in-store/wall.js +4 -14
  101. package/dist/in-store/wall.js.map +1 -1
  102. package/dist/in-store/window.d.ts.map +1 -1
  103. package/dist/in-store/window.js +2 -0
  104. package/dist/in-store/window.js.map +1 -1
  105. package/dist/index.d.ts +12 -1
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +5 -0
  108. package/dist/index.js.map +1 -1
  109. package/dist/landxml/alignment-mapping.d.ts +98 -0
  110. package/dist/landxml/alignment-mapping.d.ts.map +1 -0
  111. package/dist/landxml/alignment-mapping.js +282 -0
  112. package/dist/landxml/alignment-mapping.js.map +1 -0
  113. package/dist/landxml/alignment-record.d.ts +18 -0
  114. package/dist/landxml/alignment-record.d.ts.map +1 -0
  115. package/dist/landxml/alignment-record.js +63 -0
  116. package/dist/landxml/alignment-record.js.map +1 -0
  117. package/dist/landxml/coordinate-plausibility.d.ts +54 -0
  118. package/dist/landxml/coordinate-plausibility.d.ts.map +1 -0
  119. package/dist/landxml/coordinate-plausibility.js +59 -0
  120. package/dist/landxml/coordinate-plausibility.js.map +1 -0
  121. package/dist/landxml/landxml-to-ifc.d.ts +45 -0
  122. package/dist/landxml/landxml-to-ifc.d.ts.map +1 -0
  123. package/dist/landxml/landxml-to-ifc.js +203 -0
  124. package/dist/landxml/landxml-to-ifc.js.map +1 -0
  125. package/dist/landxml/profile-geometry.d.ts +50 -0
  126. package/dist/landxml/profile-geometry.d.ts.map +1 -0
  127. package/dist/landxml/profile-geometry.js +221 -0
  128. package/dist/landxml/profile-geometry.js.map +1 -0
  129. package/dist/landxml/profile-mapping.d.ts +36 -0
  130. package/dist/landxml/profile-mapping.d.ts.map +1 -0
  131. package/dist/landxml/profile-mapping.js +181 -0
  132. package/dist/landxml/profile-mapping.js.map +1 -0
  133. package/dist/landxml/profile-record.d.ts +46 -0
  134. package/dist/landxml/profile-record.d.ts.map +1 -0
  135. package/dist/landxml/profile-record.js +38 -0
  136. package/dist/landxml/profile-record.js.map +1 -0
  137. package/dist/landxml/refusals.d.ts +45 -0
  138. package/dist/landxml/refusals.d.ts.map +1 -0
  139. package/dist/landxml/refusals.js +141 -0
  140. package/dist/landxml/refusals.js.map +1 -0
  141. package/dist/landxml/result-types.d.ts +78 -0
  142. package/dist/landxml/result-types.d.ts.map +1 -0
  143. package/dist/landxml/result-types.js +5 -0
  144. package/dist/landxml/result-types.js.map +1 -0
  145. package/dist/landxml/source-types.d.ts +169 -0
  146. package/dist/landxml/source-types.d.ts.map +1 -0
  147. package/dist/landxml/source-types.js +5 -0
  148. package/dist/landxml/source-types.js.map +1 -0
  149. package/dist/landxml/station-equations.d.ts +69 -0
  150. package/dist/landxml/station-equations.d.ts.map +1 -0
  151. package/dist/landxml/station-equations.js +140 -0
  152. package/dist/landxml/station-equations.js.map +1 -0
  153. package/dist/landxml/writers.d.ts +33 -0
  154. package/dist/landxml/writers.d.ts.map +1 -0
  155. package/dist/landxml/writers.js +160 -0
  156. package/dist/landxml/writers.js.map +1 -0
  157. package/dist/types.d.ts +13 -2
  158. package/dist/types.d.ts.map +1 -1
  159. package/package.json +6 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-creator-alignment.js","sourceRoot":"","sources":["../src/ifc-creator-alignment.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAA0B,MAAM,gCAAgC,CAAC;AACxG,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAgC,MAAM,qCAAqC,CAAC;AAC1H,OAAO,EAAE,cAAc,EAA8B,MAAM,sCAAsC,CAAC;AA6ClG;;;;;;;;;;GAUG;AACH,MAAM,aAAa,GAAG,8BAA8B,CAAC;AACrD,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,CAAS,EAAW,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEjG,SAAS,cAAc,CAAC,OAA0B,EAAE,IAAuB;IACzE,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,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M,CAAC,gBAAgB,IAAI,EAAE;KACzC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAErD,OAAO;QACL,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB;QACxF,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function buildStepHeader(nowMs: number, author: string, organization: string, schema: string): string;
2
+ //# sourceMappingURL=ifc-creator-header.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-creator-header.d.ts","sourceRoot":"","sources":["../src/ifc-creator-header.ts"],"names":[],"mappings":"AAYA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAW3G"}
@@ -0,0 +1,22 @@
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 STEP `HEADER` section `IfcCreator.toIfc()` writes. Split out of
6
+ * `ifc-creator.ts` alongside the other emitter modules; it is a pure function
7
+ * of the creation instant, the author fields and the schema tag.
8
+ */
9
+ import { esc } from './ifc-creator-math.js';
10
+ export function buildStepHeader(nowMs, author, organization, schema) {
11
+ // ISO 8601 time_stamp: keep '-'/':', drop only milliseconds and the 'Z'.
12
+ const now = new Date(nowMs).toISOString().replace(/\.\d{3}Z$/, '');
13
+ const app = 'ifc-lite';
14
+ return `ISO-10303-21;
15
+ HEADER;
16
+ FILE_DESCRIPTION(('${esc('Created by ifc-lite')}'),'2;1');
17
+ FILE_NAME('created.ifc','${now}',('${esc(author)}'),('${esc(organization)}'),'${app}','${app}','');
18
+ FILE_SCHEMA(('${schema}'));
19
+ ENDSEC;
20
+ `;
21
+ }
22
+ //# sourceMappingURL=ifc-creator-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-creator-header.js","sourceRoot":"","sources":["../src/ifc-creator-header.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAE5C,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,MAAc,EAAE,YAAoB,EAAE,MAAc;IACjG,yEAAyE;IACzE,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACnE,MAAM,GAAG,GAAG,UAAU,CAAC;IACvB,OAAO;;qBAEY,GAAG,CAAC,qBAAqB,CAAC;2BACpB,GAAG,OAAO,GAAG,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,YAAY,CAAC,OAAO,GAAG,MAAM,GAAG;gBAC5E,MAAM;;CAErB,CAAC;AACF,CAAC"}
@@ -1,13 +1,23 @@
1
- /**
2
- * Pure utility functions and constants used by IfcCreator.
3
- * These have zero coupling to class state — they take inputs and return outputs.
4
- */
5
1
  import type { Point3D, PropertyDef, QuantityDef } from './types.js';
6
2
  /** Escape a string for STEP format */
7
3
  export declare function esc(str: string): string;
8
4
  /** Format a STEP line: #ID=TYPE(args); */
9
5
  export declare function stepLine(id: number, type: string, args: string): string;
10
- /** Serialize a number in STEP format (always with decimal point, no exponent notation) */
6
+ /**
7
+ * Serialize a number as an ISO 10303-21 REAL literal (always with a decimal
8
+ * point in the mantissa).
9
+ *
10
+ * JavaScript's own exponent form (`1e-7`, `1e+21`) has no decimal point, so
11
+ * it is not a legal `real_literal`. Small magnitudes are written as fixed
12
+ * decimal (`toFixed(10)`, which caps precision at ten places, a deliberate
13
+ * trade kept as is). `toFixed` itself switches to exponent form once
14
+ * |v| >= 1e21 (ECMA-262), so those values go through `@ifc-lite/data`'s
15
+ * `formatStepReal`, which writes the STEP exponent form with a mantissa
16
+ * point (`1.E+21`) — the same rule `@ifc-lite/export` uses (#5195).
17
+ *
18
+ * NaN and Infinity have no STEP REAL spelling at all, so they throw rather
19
+ * than reach the file as a `NaN.`/`Infinity.` token.
20
+ */
11
21
  export declare function num(v: number): string;
12
22
  /** Vector length */
13
23
  export declare function vecLen(v: Point3D): number;
@@ -41,6 +51,28 @@ export declare function assertPositiveFinite(values: Record<string, number>, con
41
51
  export declare function assertFinitePoint3(points: Record<string, Point3D>, context: string): void;
42
52
  /** Cross product */
43
53
  export declare function vecCross(a: Point3D, b: Point3D): Point3D;
54
+ /**
55
+ * Complete an `IfcAxis2Placement3D` `Axis`/`RefDirection` pair (#5469).
56
+ *
57
+ * The schema rule `IfcAxis2Placement3D.AxisAndRefDirProvision` requires the two
58
+ * to be both present or both absent, so a placement that only rotates about Z
59
+ * (a `RefDirection` with no `Axis`) is invalid as written. Returns `undefined`
60
+ * when neither is given (the `$,$` form stays), otherwise both, with the
61
+ * missing one set to the value the schema implies for it when absent, so the
62
+ * placement's geometry is unchanged:
63
+ * - no `Axis`: `(0,0,1)`, the `IfcAxis2Placement3D.P` default;
64
+ * - no `RefDirection`: `IfcFirstProjAxis(Axis, $)`, the projection of world X
65
+ * onto the plane normal to `Axis`. The schema switches to world Y only when
66
+ * the normalised `Axis` is exactly `(1,0,0)`, so this tests for an Axis
67
+ * with no Y or Z component rather than using a tolerance: a near-X Axis
68
+ * must still project X, or the result flips 180 degrees. For `-X` the
69
+ * projection of X vanishes and the schema has no answer; this writes
70
+ * `(0,-1,0)`, the value ifc-lite's reader already used for a `$` there.
71
+ */
72
+ export declare function completePlacementAxes(axis: Point3D | undefined, refDirection: Point3D | undefined): {
73
+ Axis: Point3D;
74
+ RefDirection: Point3D;
75
+ } | undefined;
44
76
  /** Emit an optional STEP string: `'value'` when present, `$` otherwise. */
45
77
  export declare function optStr(v: string | undefined | null): string;
46
78
  /** Emit an optional STEP enum: `.VALUE.` when present, `$` otherwise. */
@@ -1 +1 @@
1
- {"version":3,"file":"ifc-creator-math.d.ts","sourceRoot":"","sources":["../src/ifc-creator-math.ts"],"names":[],"mappings":"AAIA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAMpE,sCAAsC;AACtC,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,0CAA0C;AAC1C,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,0FAA0F;AAC1F,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAKrC;AAED,oBAAoB;AACpB,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAEzC;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,aAG5B,CAAC;AAEH,2FAA2F;AAC3F,wBAAgB,OAAO,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAI3C;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAM1F;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAMzF;AAED,oBAAoB;AACpB,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAMxD;AASD,2EAA2E;A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,SAAS,GAAG,IAAI,GAAG,MAAM,CAE5D;AAED,sDAAsD;AACtD,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAE3D;AAED,sEAAsE;AACtE,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAE7C;AAED,kEAAkE;AAClE,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,CAI5D;AAwBD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CA8BhE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CAY3D"}
@@ -1,6 +1,11 @@
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
+ /**
5
+ * Pure utility functions and constants used by IfcCreator.
6
+ * These have zero coupling to class state — they take inputs and return outputs.
7
+ */
8
+ import { formatStepReal } from '@ifc-lite/data';
4
9
  // ============================================================================
5
10
  // Internal helpers
6
11
  // ============================================================================
@@ -12,9 +17,27 @@ export function esc(str) {
12
17
  export function stepLine(id, type, args) {
13
18
  return `#${id}=${type}(${args});`;
14
19
  }
15
- /** Serialize a number in STEP format (always with decimal point, no exponent notation) */
20
+ /**
21
+ * Serialize a number as an ISO 10303-21 REAL literal (always with a decimal
22
+ * point in the mantissa).
23
+ *
24
+ * JavaScript's own exponent form (`1e-7`, `1e+21`) has no decimal point, so
25
+ * it is not a legal `real_literal`. Small magnitudes are written as fixed
26
+ * decimal (`toFixed(10)`, which caps precision at ten places, a deliberate
27
+ * trade kept as is). `toFixed` itself switches to exponent form once
28
+ * |v| >= 1e21 (ECMA-262), so those values go through `@ifc-lite/data`'s
29
+ * `formatStepReal`, which writes the STEP exponent form with a mantissa
30
+ * point (`1.E+21`) — the same rule `@ifc-lite/export` uses (#5195).
31
+ *
32
+ * NaN and Infinity have no STEP REAL spelling at all, so they throw rather
33
+ * than reach the file as a `NaN.`/`Infinity.` token.
34
+ */
16
35
  export function num(v) {
17
- // Exponent notation (e.g. 1e-7) is not valid STEP — use fixed decimal
36
+ if (!Number.isFinite(v)) {
37
+ throw new Error(`num: ${v} is not a finite number and cannot be written as a STEP REAL`);
38
+ }
39
+ if (Math.abs(v) >= 1e21)
40
+ return formatStepReal(v);
18
41
  const s = v.toString();
19
42
  if (s.includes('e') || s.includes('E'))
20
43
  return v.toFixed(10).replace(/0+$/, '0');
@@ -80,6 +103,39 @@ export function vecCross(a, b) {
80
103
  a[0] * b[1] - a[1] * b[0],
81
104
  ];
82
105
  }
106
+ /**
107
+ * Complete an `IfcAxis2Placement3D` `Axis`/`RefDirection` pair (#5469).
108
+ *
109
+ * The schema rule `IfcAxis2Placement3D.AxisAndRefDirProvision` requires the two
110
+ * to be both present or both absent, so a placement that only rotates about Z
111
+ * (a `RefDirection` with no `Axis`) is invalid as written. Returns `undefined`
112
+ * when neither is given (the `$,$` form stays), otherwise both, with the
113
+ * missing one set to the value the schema implies for it when absent, so the
114
+ * placement's geometry is unchanged:
115
+ * - no `Axis`: `(0,0,1)`, the `IfcAxis2Placement3D.P` default;
116
+ * - no `RefDirection`: `IfcFirstProjAxis(Axis, $)`, the projection of world X
117
+ * onto the plane normal to `Axis`. The schema switches to world Y only when
118
+ * the normalised `Axis` is exactly `(1,0,0)`, so this tests for an Axis
119
+ * with no Y or Z component rather than using a tolerance: a near-X Axis
120
+ * must still project X, or the result flips 180 degrees. For `-X` the
121
+ * projection of X vanishes and the schema has no answer; this writes
122
+ * `(0,-1,0)`, the value ifc-lite's reader already used for a `$` there.
123
+ */
124
+ export function completePlacementAxes(axis, refDirection) {
125
+ if (axis && refDirection)
126
+ return { Axis: axis, RefDirection: refDirection };
127
+ if (refDirection)
128
+ return { Axis: [0, 0, 1], RefDirection: refDirection };
129
+ if (!axis)
130
+ return undefined;
131
+ const z = vecNorm(axis);
132
+ // Along X, world X projects to zero: +X takes world Y (the schema's rule),
133
+ // -X takes (0,-1,0), which is (0,0,1) x Axis as ifc-lite's own reader fills a
134
+ // `$` there (`build_axis2_matrix`), so nothing renders turned from before.
135
+ const v = z[1] === 0 && z[2] === 0 ? [0, z[0] > 0 ? 1 : -1, 0] : [1, 0, 0];
136
+ const d = v[0] * z[0] + v[1] * z[1] + v[2] * z[2];
137
+ return { Axis: axis, RefDirection: vecNorm([v[0] - d * z[0], v[1] - d * z[1], v[2] - d * z[2]]) };
138
+ }
83
139
  // ============================================================================
84
140
  // STEP attribute helpers (optional strings / enums / booleans / reals)
85
141
  // ============================================================================
@@ -116,6 +172,25 @@ export function intList(values) {
116
172
  ? '$'
117
173
  : `(${values.map(v => String(Math.trunc(v))).join(',')})`;
118
174
  }
175
+ /**
176
+ * Measures whose value is a count, written as an integer literal when the value
177
+ * is whole. IfcCountMeasure is NUMBER in IFC4 and INTEGER from IFC4X3 on; an
178
+ * integer literal is valid for both, whereas `12.` is not an INTEGER.
179
+ */
180
+ const INTEGER_VALUED_MEASURES = new Set(['IfcCountMeasure']);
181
+ /** Declared types a number has always been written as IFCREAL under, unchanged. */
182
+ const NON_NUMERIC_TYPES = new Set(['IfcLabel', 'IfcText', 'IfcIdentifier', 'IfcBoolean', 'IfcLogical']);
183
+ /**
184
+ * The type name is interpolated into STEP as `TYPENAME(value)`, and untyped
185
+ * callers (the sandbox, JSON input) can pass any string. Anything that is not a
186
+ * bare IFC identifier would corrupt the line, so it is refused rather than
187
+ * written.
188
+ */
189
+ function assertStepTypeName(typeName) {
190
+ if (!/^Ifc[A-Za-z]+$/.test(typeName)) {
191
+ throw new Error(`Invalid property value type "${typeName}": expected an IFC type name such as IfcPositiveLengthMeasure`);
192
+ }
193
+ }
119
194
  /**
120
195
  * Serialize an IfcPropertySingleValue NominalValue as a named SELECT branch.
121
196
  *
@@ -124,12 +199,26 @@ export function intList(values) {
124
199
  */
125
200
  export function serializePropertyValue(prop) {
126
201
  const val = prop.NominalValue;
202
+ // An empty `Type` (a JSON payload that defaults an unset field to '') means
203
+ // "not declared", exactly like an absent one.
204
+ const declared = prop.Type || undefined;
127
205
  if (typeof val === 'string') {
128
- const typeName = prop.Type ?? 'IfcLabel';
206
+ const typeName = declared ?? 'IfcLabel';
207
+ assertStepTypeName(typeName);
129
208
  return `${typeName.toUpperCase()}('${esc(val)}')`;
130
209
  }
131
210
  if (typeof val === 'number') {
132
- const typeName = prop.Type ?? (Number.isInteger(val) ? 'IfcInteger' : 'IfcReal');
211
+ const typeName = declared ?? (Number.isInteger(val) ? 'IfcInteger' : 'IfcReal');
212
+ // A declared measure type is written AS that type. This used to emit every
213
+ // number as IFCINTEGER or IFCREAL whatever `Type` said, so a
214
+ // `ThermalTransmittance` declared an IfcThermalTransmittanceMeasure came out
215
+ // an IFCREAL and failed any IDS data-type check against Pset_WallCommon.
216
+ if (typeName !== 'IfcInteger' && !NON_NUMERIC_TYPES.has(typeName)) {
217
+ assertStepTypeName(typeName);
218
+ return INTEGER_VALUED_MEASURES.has(typeName) && Number.isInteger(val)
219
+ ? `${typeName.toUpperCase()}(${val})`
220
+ : `${typeName.toUpperCase()}(${num(val)})`;
221
+ }
133
222
  return typeName === 'IfcInteger' ? `IFCINTEGER(${Math.round(val)})` : `IFCREAL(${num(val)})`;
134
223
  }
135
224
  if (typeof val === 'boolean') {
@@ -1 +1 @@
1
- {"version":3,"file":"ifc-creator-math.js","sourceRoot":"","sources":["../src/ifc-creator-math.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAS/D,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,sCAAsC;AACtC,MAAM,UAAU,GAAG,CAAC,GAAW;IAC7B,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACxD,CAAC;AA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@@
1
+ /**
2
+ * The `IfcRel*` rows `IfcCreator` writes once, at `toIfc()`.
3
+ *
4
+ * Split out of `ifc-creator.ts` for the same reason as the other emitter
5
+ * modules: this is pure STEP assembly over collections the creator already
6
+ * holds, and it needs nothing from the class but the `emit` hook.
7
+ */
8
+ /** The creator hooks these emitters need. */
9
+ export interface RelationshipContext {
10
+ emit: (type: string, attrs: string) => number;
11
+ newGlobalId: () => string;
12
+ /** `#<id>` of the shared `IfcOwnerHistory`. */
13
+ ownerRef: string;
14
+ }
15
+ export interface SpatialStructure extends RelationshipContext {
16
+ projectId: number;
17
+ siteId: number;
18
+ buildingId: number;
19
+ storeyIds: readonly number[];
20
+ storeyElements: ReadonlyMap<number, readonly number[]>;
21
+ /**
22
+ * Products contained in the site rather than a storey — terrain surfaces and
23
+ * survey annotations, which have no storey to belong to.
24
+ */
25
+ siteElements: readonly number[];
26
+ /**
27
+ * Products aggregated by the project directly — `IfcAlignment`, which IFC 4.3
28
+ * relates to the project rather than containing it in a spatial element.
29
+ */
30
+ projectElements?: readonly number[];
31
+ }
32
+ export declare function emitRelAggregates(relatingId: number, relatedIds: readonly number[], ctx: RelationshipContext): number;
33
+ export declare function emitRelContainedInSpatialStructure(structureId: number, elementIds: readonly number[], ctx: RelationshipContext): number;
34
+ export declare function emitRelFillsElement(openingId: number, fillingId: number, ctx: RelationshipContext): number;
35
+ /**
36
+ * Project → site → building → storeys, then each container's contents.
37
+ *
38
+ * An empty collection writes no row at all: `IfcRelAggregates.RelatedObjects`
39
+ * and `IfcRelContainedInSpatialStructure.RelatedElements` are both `SET [1:?]`,
40
+ * so an empty one is invalid rather than merely useless.
41
+ */
42
+ export declare function emitSpatialRelationships(structure: SpatialStructure): void;
43
+ //# sourceMappingURL=ifc-creator-relationships.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-creator-relationships.d.ts","sourceRoot":"","sources":["../src/ifc-creator-relationships.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;IACvD;;;OAGG;IACH,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC;;;OAGG;IACH,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAMD,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,mBAAmB,GAC1E,MAAM,CAER;AAED,wBAAgB,kCAAkC,CAChD,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,mBAAmB,GAC3E,MAAM,CAKR;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,mBAAmB,GAC7D,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAiB1E"}
@@ -0,0 +1,38 @@
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
+ function refs(ids) {
5
+ return ids.map((id) => `#${id}`).join(',');
6
+ }
7
+ export function emitRelAggregates(relatingId, relatedIds, ctx) {
8
+ return ctx.emit('IFCRELAGGREGATES', `'${ctx.newGlobalId()}',${ctx.ownerRef},$,$,#${relatingId},(${refs(relatedIds)})`);
9
+ }
10
+ export function emitRelContainedInSpatialStructure(structureId, elementIds, ctx) {
11
+ return ctx.emit('IFCRELCONTAINEDINSPATIALSTRUCTURE', `'${ctx.newGlobalId()}',${ctx.ownerRef},$,$,(${refs(elementIds)}),#${structureId}`);
12
+ }
13
+ export function emitRelFillsElement(openingId, fillingId, ctx) {
14
+ return ctx.emit('IFCRELFILLSELEMENT', `'${ctx.newGlobalId()}',${ctx.ownerRef},$,$,#${openingId},#${fillingId}`);
15
+ }
16
+ /**
17
+ * Project → site → building → storeys, then each container's contents.
18
+ *
19
+ * An empty collection writes no row at all: `IfcRelAggregates.RelatedObjects`
20
+ * and `IfcRelContainedInSpatialStructure.RelatedElements` are both `SET [1:?]`,
21
+ * so an empty one is invalid rather than merely useless.
22
+ */
23
+ export function emitSpatialRelationships(structure) {
24
+ emitRelAggregates(structure.projectId, [structure.siteId, ...(structure.projectElements ?? [])], structure);
25
+ emitRelAggregates(structure.siteId, [structure.buildingId], structure);
26
+ if (structure.storeyIds.length > 0) {
27
+ emitRelAggregates(structure.buildingId, structure.storeyIds, structure);
28
+ }
29
+ for (const [storeyId, elementIds] of structure.storeyElements) {
30
+ if (elementIds.length > 0) {
31
+ emitRelContainedInSpatialStructure(storeyId, elementIds, structure);
32
+ }
33
+ }
34
+ if (structure.siteElements.length > 0) {
35
+ emitRelContainedInSpatialStructure(structure.siteId, structure.siteElements, structure);
36
+ }
37
+ }
38
+ //# sourceMappingURL=ifc-creator-relationships.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-creator-relationships.js","sourceRoot":"","sources":["../src/ifc-creator-relationships.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAoC/D,SAAS,IAAI,CAAC,GAAsB;IAClC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,EA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AS,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC1E,CAAC;IAED,KAAK,MAAM,CAAC,QAAQ,EAAE,UAAU,CAAC,IAAI,SAAS,CAAC,cAAc,EAAE,CAAC;QAC9D,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,kCAAkC,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,IAAI,SAAS,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtC,kCAAkC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ /** The one creator hook these emitters need. */
2
+ export interface StyleContext {
3
+ emit: (type: string, attrs: string) => number;
4
+ }
5
+ /** A per-element colour assignment, as `IfcCreator` records it. */
6
+ export interface ElementColor {
7
+ name: string;
8
+ rgb: [number, number, number];
9
+ }
10
+ /** A named `IfcSurfaceStyle` with the given RGB colour. */
11
+ export declare function emitColorStyle(name: string, rgb: readonly [number, number, number], ctx: StyleContext): number;
12
+ /** The default `IfcSurfaceStyle` — warm concrete grey (RGB 0.75, 0.73, 0.68). */
13
+ export declare function emitDefaultStyle(ctx: StyleContext): number;
14
+ /**
15
+ * Bind a style to every representation item of every element.
16
+ *
17
+ * Identical colours share one `IfcSurfaceStyle`: without the cache, N elements
18
+ * painted the same colour wrote N identical style trees, which is legal but
19
+ * bloats the file and makes a diff between two exports unreadable.
20
+ */
21
+ export declare function emitStyledItems(elementSolids: ReadonlyMap<number, readonly number[]>, elementColors: ReadonlyMap<number, ElementColor>, defaultStyleId: number, ctx: StyleContext): void;
22
+ //# sourceMappingURL=ifc-creator-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-creator-styles.d.ts","sourceRoot":"","sources":["../src/ifc-creator-styles.ts"],"names":[],"mappings":"AAcA,gDAAgD;AAChD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/C;AAED,mEAAmE;AACnE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED,2DAA2D;AAC3D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,GAAG,MAAM,CAO9G;AAED,iFAAiF;AACjF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAE1D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,EACrD,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,EAChD,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,YAAY,GAChB,IAAI,CAmBN"}
@@ -0,0 +1,50 @@
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
+ * Surface styling for `IfcCreator`: the default grey, named colour styles, and
6
+ * the `IfcStyledItem` rows that bind them to representation items.
7
+ *
8
+ * Split out of `ifc-creator.ts` alongside the other emitter modules — this is
9
+ * pure STEP assembly over maps the creator already holds.
10
+ */
11
+ import { esc, num } from './ifc-creator-math.js';
12
+ /** A named `IfcSurfaceStyle` with the given RGB colour. */
13
+ export function emitColorStyle(name, rgb, ctx) {
14
+ const colourId = ctx.emit('IFCCOLOURRGB', `$,${num(rgb[0])},${num(rgb[1])},${num(rgb[2])}`);
15
+ const renderingId = ctx.emit('IFCSURFACESTYLERENDERING', `#${colourId},0.,$,$,$,$,IFCNORMALISEDRATIOMEASURE(0.5),IFCSPECULAREXPONENT(64.),.NOTDEFINED.`);
16
+ return ctx.emit('IFCSURFACESTYLE', `'${esc(name)}',.BOTH.,(#${renderingId})`);
17
+ }
18
+ /** The default `IfcSurfaceStyle` — warm concrete grey (RGB 0.75, 0.73, 0.68). */
19
+ export function emitDefaultStyle(ctx) {
20
+ return emitColorStyle('Default', [0.75, 0.73, 0.68], ctx);
21
+ }
22
+ /**
23
+ * Bind a style to every representation item of every element.
24
+ *
25
+ * Identical colours share one `IfcSurfaceStyle`: without the cache, N elements
26
+ * painted the same colour wrote N identical style trees, which is legal but
27
+ * bloats the file and makes a diff between two exports unreadable.
28
+ */
29
+ export function emitStyledItems(elementSolids, elementColors, defaultStyleId, ctx) {
30
+ const styleCache = new Map();
31
+ for (const [elementId, solidIds] of elementSolids) {
32
+ const color = elementColors.get(elementId);
33
+ let styleId = defaultStyleId;
34
+ if (color) {
35
+ const key = `${color.name}|${color.rgb.join(',')}`;
36
+ const cached = styleCache.get(key);
37
+ if (cached !== undefined) {
38
+ styleId = cached;
39
+ }
40
+ else {
41
+ styleId = emitColorStyle(color.name, color.rgb, ctx);
42
+ styleCache.set(key, styleId);
43
+ }
44
+ }
45
+ for (const solidId of solidIds) {
46
+ ctx.emit('IFCSTYLEDITEM', `#${solidId},(#${styleId}),$`);
47
+ }
48
+ }
49
+ }
50
+ //# sourceMappingURL=ifc-creator-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ifc-creator-styles.js","sourceRoot":"","sources":["../src/ifc-creator-styles.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAE/D;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAajD,2DAA2D;AAC3D,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,GAAsC,EAAE,GAAiB;IACpG,MAAM,QAA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BACN,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACrD,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,OAAO,MAAM,OAAO,KAAK,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,170 @@
1
+ import { type AlignmentParams, type AlignmentResult } from './ifc-creator-alignment.js';
2
+ /** The creator hooks these emitters need. */
3
+ export interface TerrainContext {
4
+ /** Allocate an express id, write its STEP line, return the id. */
5
+ emit: (type: string, attrs: string) => number;
6
+ newGlobalId: () => string;
7
+ /** `#<id>` of the shared `IfcOwnerHistory`. */
8
+ ownerRef: string;
9
+ /** `#<id>` of the `IfcGeometricRepresentationContext` ('Model'). */
10
+ modelContextRef: string;
11
+ /** `#<id>` of the 'Body' subcontext. */
12
+ bodyContextRef: string;
13
+ /** `#<id>` of the 'Axis' subcontext — an alignment's representation lives there. */
14
+ axisContextRef: string;
15
+ /** `#<id>` of the placement products of the site hang from. */
16
+ sitePlacementRef: string;
17
+ /** Reject anything this schema cannot express. */
18
+ assertSchema: (feature: string) => void;
19
+ }
20
+ /** A single terrain surface: a TIN and the element that carries it. */
21
+ export interface TerrainSurfaceParams {
22
+ Name: string;
23
+ Description?: string | null;
24
+ /** Supply to make the GlobalId a function of the source id (§4.3). */
25
+ GlobalId?: string;
26
+ /** `(easting, northing, elevation)` per vertex, in the file's length unit. */
27
+ Coordinates: ReadonlyArray<readonly [number, number, number]>;
28
+ /** **1-based** triples indexing `Coordinates`, per `IfcTriangulatedFaceSet`. */
29
+ Triangles: ReadonlyArray<readonly [number, number, number]>;
30
+ /**
31
+ * `IfcTriangulatedIrregularNetwork.Flags` — mandatory and non-empty, unlike
32
+ * most IFC list attributes. Defaults to a single `0` (no flag set).
33
+ */
34
+ Flags?: readonly number[];
35
+ }
36
+ export interface TerrainSurfaceResult {
37
+ elementId: number;
38
+ /** The `IfcTriangulatedIrregularNetwork`, so a caller can assert on it directly. */
39
+ tinId: number;
40
+ coordinateListId: number;
41
+ }
42
+ /** One survey point, shaped like the IfcOpenShell control in §8.2 of the mapping. */
43
+ export interface SurveyPointParams {
44
+ Name?: string | null;
45
+ Description?: string | null;
46
+ GlobalId?: string;
47
+ /** `(easting, northing, elevation)` in the file's length unit. */
48
+ Location: readonly [number, number, number];
49
+ }
50
+ /** A `Pset`-style bag attached to one product. Values are written as IFCLABEL. */
51
+ export interface SurveyPropertySetParams {
52
+ Name: string;
53
+ GlobalId?: string;
54
+ Properties: ReadonlyArray<{
55
+ Name: string;
56
+ Value: string;
57
+ }>;
58
+ }
59
+ export interface GeoreferencingParams {
60
+ /** `IfcProjectedCRS.Name` — required in practice by the `NameOrWKT` rule. */
61
+ Name: string;
62
+ Description?: string | null;
63
+ GeodeticDatum?: string | null;
64
+ VerticalDatum?: string | null;
65
+ MapProjection?: string | null;
66
+ MapZone?: string | null;
67
+ /** `#<id>` of a length `IfcNamedUnit`, or omit for `$`. */
68
+ MapUnitRef?: string;
69
+ Eastings?: number;
70
+ Northings?: number;
71
+ OrthogonalHeight?: number;
72
+ XAxisAbscissa?: number;
73
+ XAxisOrdinate?: number;
74
+ Scale?: number;
75
+ }
76
+ /**
77
+ * Write a terrain surface: `IfcCartesianPointList3D` → `IfcTriangulatedIrregularNetwork`
78
+ * → `IfcShapeRepresentation` → `IfcGeographicElement`/`.TERRAIN.`.
79
+ *
80
+ * The `IfcTriangulatedIrregularNetwork` constraints in §4.1 are enforced here
81
+ * rather than assumed, because both fail open in a STEP file: `Closed` omitted
82
+ * as `$` does not satisfy `NotClosed : Closed = FALSE`, and an empty `Flags`
83
+ * violates `LIST [1:?]`. Neither shows up as a parse error downstream.
84
+ */
85
+ export declare function emitTerrainSurface(params: TerrainSurfaceParams, ctx: TerrainContext): TerrainSurfaceResult;
86
+ /**
87
+ * Write one survey point as `IfcAnnotation`/`.SURVEY.`.
88
+ *
89
+ * The position lives in the `IfcLocalPlacement`, and the representation is an
90
+ * `IfcCartesianPoint` at the LOCAL origin — not a second copy of the
91
+ * coordinate. That split is deliberate: it is the shape the IfcOpenShell
92
+ * control in §8.2 writes, which is what makes our output comparable to
93
+ * something produced outside this repo, and it keeps one authoritative
94
+ * location per point instead of two that can disagree.
95
+ */
96
+ export declare function emitSurveyPoint(params: SurveyPointParams, ctx: TerrainContext): number;
97
+ /**
98
+ * Attach a property set to one product. Values are written as `IFCLABEL`
99
+ * regardless of how numeric they look: a LandXML attribute is text, and
100
+ * promoting `'00123'` to a number would lose a leading zero that identifies
101
+ * the point.
102
+ */
103
+ export declare function emitSurveyPropertySet(productId: number, params: SurveyPropertySetParams, ctx: TerrainContext): number;
104
+ /**
105
+ * Write `IfcProjectedCRS` + `IfcMapConversion`.
106
+ *
107
+ * `SourceCRS` is the model `IfcGeometricRepresentationContext` and `TargetCRS`
108
+ * the projected CRS, which is what `TargetCRSOnlyProjected` requires. Callers
109
+ * emit this only where the source actually declares a coordinate system —
110
+ * §4.2 forbids a placeholder CRS, because a wrong CRS is worse than none.
111
+ */
112
+ export declare function emitGeoreferencing(params: GeoreferencingParams, ctx: TerrainContext): {
113
+ crsId: number;
114
+ mapConversionId: number;
115
+ };
116
+ /** The creator state a `TerrainWriter` mutates, kept behind functions. */
117
+ export interface TerrainWriterHost {
118
+ /** Record a product as contained in the site and as a created entity. */
119
+ trackSiteProduct: (expressId: number, type: string, name: string | undefined) => void;
120
+ /** `#<id>` of the length unit `IfcProjectedCRS.MapUnit` defaults to. */
121
+ lengthUnitRef: () => string;
122
+ /** Throws if georeferencing was already declared for this file. */
123
+ claimGeoreferencing: () => void;
124
+ /** The `IfcSite` every terrain product is contained in. */
125
+ siteId: () => number;
126
+ /** Record a product the PROJECT aggregates directly (an `IfcAlignment`). */
127
+ trackProjectProduct: (expressId: number, type: string, name: string | undefined) => void;
128
+ }
129
+ /**
130
+ * Terrain/survey authoring, reached through `IfcCreator.terrain()`.
131
+ *
132
+ * Every product this writes is contained in the **site**, not a storey.
133
+ * Terrain and survey points have no storey, and inventing one would place them
134
+ * on a datum the LandXML source never declared — the storey's `Elevation` is
135
+ * applied to its children, so a fabricated storey silently shifts every
136
+ * coordinate.
137
+ */
138
+ export interface TerrainWriter {
139
+ /**
140
+ * The `IfcSite` these products are contained in — the anchor for a
141
+ * file-level property set such as the conversion's provenance.
142
+ */
143
+ readonly siteId: number;
144
+ /**
145
+ * Add one terrain surface: `IfcGeographicElement`/`.TERRAIN.` carrying an
146
+ * `IfcTriangulatedIrregularNetwork`. `Coordinates` are
147
+ * `(easting, northing, elevation)` in this file's length unit; `Triangles`
148
+ * are 1-based.
149
+ */
150
+ addSurface(params: TerrainSurfaceParams): TerrainSurfaceResult;
151
+ /** Add one survey point as `IfcAnnotation`/`.SURVEY.`. */
152
+ addSurveyPoint(params: SurveyPointParams): number;
153
+ /** Attach a text-valued property set to any product. */
154
+ addPropertySet(productId: number, params: SurveyPropertySetParams): number;
155
+ /**
156
+ * Declare the projected CRS and the map conversion from it to this file's
157
+ * engineering coordinates. At most once per file.
158
+ */
159
+ setGeoreferencing(params: GeoreferencingParams): {
160
+ crsId: number;
161
+ mapConversionId: number;
162
+ };
163
+ /**
164
+ * Add a horizontal alignment — `IfcAlignment` with its semantic layout and
165
+ * its composite-curve geometry, aggregated by the project (mapping spec §11).
166
+ */
167
+ addAlignment(params: AlignmentParams): AlignmentResult;
168
+ }
169
+ export declare function createTerrainWriter(ctx: TerrainContext, host: TerrainWriterHost): TerrainWriter;
170
+ //# sourceMappingURL=ifc-creator-terrain.d.ts.map