@ifc-lite/drawing-2d 1.4.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 (158) hide show
  1. package/LICENSE +373 -0
  2. package/dist/drawing-generator.d.ts +80 -0
  3. package/dist/drawing-generator.d.ts.map +1 -0
  4. package/dist/drawing-generator.js +281 -0
  5. package/dist/drawing-generator.js.map +1 -0
  6. package/dist/edge-extractor.d.ts +47 -0
  7. package/dist/edge-extractor.d.ts.map +1 -0
  8. package/dist/edge-extractor.js +204 -0
  9. package/dist/edge-extractor.js.map +1 -0
  10. package/dist/gpu-section-cutter.d.ts +42 -0
  11. package/dist/gpu-section-cutter.d.ts.map +1 -0
  12. package/dist/gpu-section-cutter.js +405 -0
  13. package/dist/gpu-section-cutter.js.map +1 -0
  14. package/dist/graphic-overrides/index.d.ts +10 -0
  15. package/dist/graphic-overrides/index.d.ts.map +1 -0
  16. package/dist/graphic-overrides/index.js +8 -0
  17. package/dist/graphic-overrides/index.js.map +1 -0
  18. package/dist/graphic-overrides/presets.d.ts +22 -0
  19. package/dist/graphic-overrides/presets.d.ts.map +1 -0
  20. package/dist/graphic-overrides/presets.js +283 -0
  21. package/dist/graphic-overrides/presets.js.map +1 -0
  22. package/dist/graphic-overrides/rule-engine.d.ts +64 -0
  23. package/dist/graphic-overrides/rule-engine.d.ts.map +1 -0
  24. package/dist/graphic-overrides/rule-engine.js +438 -0
  25. package/dist/graphic-overrides/rule-engine.js.map +1 -0
  26. package/dist/graphic-overrides/types.d.ts +200 -0
  27. package/dist/graphic-overrides/types.d.ts.map +1 -0
  28. package/dist/graphic-overrides/types.js +5 -0
  29. package/dist/graphic-overrides/types.js.map +1 -0
  30. package/dist/hatch-generator.d.ts +76 -0
  31. package/dist/hatch-generator.d.ts.map +1 -0
  32. package/dist/hatch-generator.js +282 -0
  33. package/dist/hatch-generator.js.map +1 -0
  34. package/dist/hidden-line.d.ts +64 -0
  35. package/dist/hidden-line.d.ts.map +1 -0
  36. package/dist/hidden-line.js +318 -0
  37. package/dist/hidden-line.js.map +1 -0
  38. package/dist/index.d.ts +44 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +109 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/line-merger.d.ts +35 -0
  43. package/dist/line-merger.d.ts.map +1 -0
  44. package/dist/line-merger.js +265 -0
  45. package/dist/line-merger.js.map +1 -0
  46. package/dist/math.d.ts +90 -0
  47. package/dist/math.d.ts.map +1 -0
  48. package/dist/math.js +284 -0
  49. package/dist/math.js.map +1 -0
  50. package/dist/openings/index.d.ts +7 -0
  51. package/dist/openings/index.d.ts.map +1 -0
  52. package/dist/openings/index.js +10 -0
  53. package/dist/openings/index.js.map +1 -0
  54. package/dist/openings/opening-filter.d.ts +61 -0
  55. package/dist/openings/opening-filter.d.ts.map +1 -0
  56. package/dist/openings/opening-filter.js +244 -0
  57. package/dist/openings/opening-filter.js.map +1 -0
  58. package/dist/openings/opening-relationship-builder.d.ts +35 -0
  59. package/dist/openings/opening-relationship-builder.d.ts.map +1 -0
  60. package/dist/openings/opening-relationship-builder.js +121 -0
  61. package/dist/openings/opening-relationship-builder.js.map +1 -0
  62. package/dist/openings/opening-utils.d.ts +55 -0
  63. package/dist/openings/opening-utils.d.ts.map +1 -0
  64. package/dist/openings/opening-utils.js +128 -0
  65. package/dist/openings/opening-utils.js.map +1 -0
  66. package/dist/polygon-builder.d.ts +62 -0
  67. package/dist/polygon-builder.d.ts.map +1 -0
  68. package/dist/polygon-builder.js +261 -0
  69. package/dist/polygon-builder.js.map +1 -0
  70. package/dist/section-cutter.d.ts +49 -0
  71. package/dist/section-cutter.d.ts.map +1 -0
  72. package/dist/section-cutter.js +220 -0
  73. package/dist/section-cutter.js.map +1 -0
  74. package/dist/sheet/frame-renderer.d.ts +28 -0
  75. package/dist/sheet/frame-renderer.d.ts.map +1 -0
  76. package/dist/sheet/frame-renderer.js +199 -0
  77. package/dist/sheet/frame-renderer.js.map +1 -0
  78. package/dist/sheet/frame-types.d.ts +57 -0
  79. package/dist/sheet/frame-types.d.ts.map +1 -0
  80. package/dist/sheet/frame-types.js +88 -0
  81. package/dist/sheet/frame-types.js.map +1 -0
  82. package/dist/sheet/index.d.ts +26 -0
  83. package/dist/sheet/index.d.ts.map +1 -0
  84. package/dist/sheet/index.js +12 -0
  85. package/dist/sheet/index.js.map +1 -0
  86. package/dist/sheet/paper-sizes.d.ts +36 -0
  87. package/dist/sheet/paper-sizes.d.ts.map +1 -0
  88. package/dist/sheet/paper-sizes.js +252 -0
  89. package/dist/sheet/paper-sizes.js.map +1 -0
  90. package/dist/sheet/scale-bar-renderer.d.ts +29 -0
  91. package/dist/sheet/scale-bar-renderer.d.ts.map +1 -0
  92. package/dist/sheet/scale-bar-renderer.js +287 -0
  93. package/dist/sheet/scale-bar-renderer.js.map +1 -0
  94. package/dist/sheet/scale-bar-types.d.ts +82 -0
  95. package/dist/sheet/scale-bar-types.d.ts.map +1 -0
  96. package/dist/sheet/scale-bar-types.js +66 -0
  97. package/dist/sheet/scale-bar-types.js.map +1 -0
  98. package/dist/sheet/sheet-types.d.ts +84 -0
  99. package/dist/sheet/sheet-types.d.ts.map +1 -0
  100. package/dist/sheet/sheet-types.js +77 -0
  101. package/dist/sheet/sheet-types.js.map +1 -0
  102. package/dist/sheet/title-block-renderer.d.ts +44 -0
  103. package/dist/sheet/title-block-renderer.d.ts.map +1 -0
  104. package/dist/sheet/title-block-renderer.js +335 -0
  105. package/dist/sheet/title-block-renderer.js.map +1 -0
  106. package/dist/sheet/title-block-types.d.ts +100 -0
  107. package/dist/sheet/title-block-types.d.ts.map +1 -0
  108. package/dist/sheet/title-block-types.js +174 -0
  109. package/dist/sheet/title-block-types.js.map +1 -0
  110. package/dist/styles.d.ts +77 -0
  111. package/dist/styles.d.ts.map +1 -0
  112. package/dist/styles.js +347 -0
  113. package/dist/styles.js.map +1 -0
  114. package/dist/styling/index.d.ts +7 -0
  115. package/dist/styling/index.d.ts.map +1 -0
  116. package/dist/styling/index.js +10 -0
  117. package/dist/styling/index.js.map +1 -0
  118. package/dist/styling/layer-mapping.d.ts +57 -0
  119. package/dist/styling/layer-mapping.d.ts.map +1 -0
  120. package/dist/styling/layer-mapping.js +303 -0
  121. package/dist/styling/layer-mapping.js.map +1 -0
  122. package/dist/styling/line-styles.d.ts +49 -0
  123. package/dist/styling/line-styles.d.ts.map +1 -0
  124. package/dist/styling/line-styles.js +123 -0
  125. package/dist/styling/line-styles.js.map +1 -0
  126. package/dist/styling/line-weights.d.ts +61 -0
  127. package/dist/styling/line-weights.d.ts.map +1 -0
  128. package/dist/styling/line-weights.js +183 -0
  129. package/dist/styling/line-weights.js.map +1 -0
  130. package/dist/svg-exporter.d.ts +63 -0
  131. package/dist/svg-exporter.d.ts.map +1 -0
  132. package/dist/svg-exporter.js +278 -0
  133. package/dist/svg-exporter.js.map +1 -0
  134. package/dist/symbols/door-symbol.d.ts +82 -0
  135. package/dist/symbols/door-symbol.d.ts.map +1 -0
  136. package/dist/symbols/door-symbol.js +390 -0
  137. package/dist/symbols/door-symbol.js.map +1 -0
  138. package/dist/symbols/index.d.ts +8 -0
  139. package/dist/symbols/index.d.ts.map +1 -0
  140. package/dist/symbols/index.js +11 -0
  141. package/dist/symbols/index.js.map +1 -0
  142. package/dist/symbols/symbol-renderer.d.ts +29 -0
  143. package/dist/symbols/symbol-renderer.d.ts.map +1 -0
  144. package/dist/symbols/symbol-renderer.js +173 -0
  145. package/dist/symbols/symbol-renderer.js.map +1 -0
  146. package/dist/symbols/symbol-utils.d.ts +48 -0
  147. package/dist/symbols/symbol-utils.d.ts.map +1 -0
  148. package/dist/symbols/symbol-utils.js +129 -0
  149. package/dist/symbols/symbol-utils.js.map +1 -0
  150. package/dist/symbols/window-symbol.d.ts +57 -0
  151. package/dist/symbols/window-symbol.d.ts.map +1 -0
  152. package/dist/symbols/window-symbol.js +209 -0
  153. package/dist/symbols/window-symbol.js.map +1 -0
  154. package/dist/types.d.ts +443 -0
  155. package/dist/types.d.ts.map +1 -0
  156. package/dist/types.js +31 -0
  157. package/dist/types.js.map +1 -0
  158. package/package.json +53 -0
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Drawing Sheet Module
3
+ *
4
+ * Provides complete architectural drawing sheet support:
5
+ * - Paper sizes (ISO, ANSI, ARCH)
6
+ * - Drawing frames with zone references
7
+ * - Title blocks with editable fields
8
+ * - Scale bars and north arrows
9
+ */
10
+ export type { PaperOrientation, PaperSizeCategory, PaperSizeDefinition, } from './paper-sizes';
11
+ export { PAPER_SIZE_REGISTRY, getPaperSizesByCategory, getDefaultPaperSize, } from './paper-sizes';
12
+ export type { FrameStyle, FrameBorderConfig, FrameMargins, DrawingFrame, } from './frame-types';
13
+ export { FRAME_PRESETS, createFrame, getDefaultFrame, } from './frame-types';
14
+ export type { TitleBlockPosition, TitleBlockLayout, TitleBlockField, TitleBlockLogo, RevisionEntry, TitleBlockConfig, } from './title-block-types';
15
+ export { DEFAULT_TITLE_BLOCK_FIELDS, TITLE_BLOCK_PRESETS, createTitleBlock, getDefaultTitleBlock, updateTitleBlockField, } from './title-block-types';
16
+ export type { ScaleBarStyle, ScaleBarPosition, ScaleBarUnits, ScaleBarConfig, NorthArrowStyle, NorthArrowConfig, } from './scale-bar-types';
17
+ export { DEFAULT_SCALE_BAR, DEFAULT_NORTH_ARROW, calculateOptimalScaleBarLength, calculateOptimalDivisions, } from './scale-bar-types';
18
+ export type { ViewportBounds, DrawingSheet, SheetCreationOptions, } from './sheet-types';
19
+ export { calculateViewportBounds, calculateDrawingTransform, } from './sheet-types';
20
+ export type { FrameRenderResult, } from './frame-renderer';
21
+ export { renderFrame } from './frame-renderer';
22
+ export type { FrameInnerBounds, TitleBlockRenderResult, TitleBlockExtras, } from './title-block-renderer';
23
+ export { renderTitleBlock } from './title-block-renderer';
24
+ export type { PositionMm } from './scale-bar-renderer';
25
+ export { renderScaleBar, renderNorthArrow } from './scale-bar-renderer';
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sheet/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAGH,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,aAAa,EACb,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,8BAA8B,EAC9B,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EACV,cAAc,EACd,YAAY,EACZ,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AAGvB,YAAY,EACV,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,12 @@
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
+ export { PAPER_SIZE_REGISTRY, getPaperSizesByCategory, getDefaultPaperSize, } from './paper-sizes';
5
+ export { FRAME_PRESETS, createFrame, getDefaultFrame, } from './frame-types';
6
+ export { DEFAULT_TITLE_BLOCK_FIELDS, TITLE_BLOCK_PRESETS, createTitleBlock, getDefaultTitleBlock, updateTitleBlockField, } from './title-block-types';
7
+ export { DEFAULT_SCALE_BAR, DEFAULT_NORTH_ARROW, calculateOptimalScaleBarLength, calculateOptimalDivisions, } from './scale-bar-types';
8
+ export { calculateViewportBounds, calculateDrawingTransform, } from './sheet-types';
9
+ export { renderFrame } from './frame-renderer';
10
+ export { renderTitleBlock } from './title-block-renderer';
11
+ export { renderScaleBar, renderNorthArrow } from './scale-bar-renderer';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sheet/index.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAkB/D,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AASvB,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAC;AAWvB,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAW7B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,8BAA8B,EAC9B,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AAMvB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Paper Size Definitions
3
+ *
4
+ * Comprehensive paper size registry supporting:
5
+ * - ISO A-series (A0-A4)
6
+ * - US ANSI series (Letter, Legal, Tabloid, C-E)
7
+ * - Architectural ARCH series (A-E1)
8
+ */
9
+ /** Paper orientation */
10
+ export type PaperOrientation = 'portrait' | 'landscape';
11
+ /** Paper size category for grouping in UI */
12
+ export type PaperSizeCategory = 'ISO' | 'ANSI' | 'ARCH' | 'custom';
13
+ /** Complete paper size definition */
14
+ export interface PaperSizeDefinition {
15
+ /** Unique identifier (e.g., 'A3_LANDSCAPE') */
16
+ id: string;
17
+ /** Display name */
18
+ name: string;
19
+ /** Category for grouping in UI */
20
+ category: PaperSizeCategory;
21
+ /** Width in millimeters */
22
+ widthMm: number;
23
+ /** Height in millimeters */
24
+ heightMm: number;
25
+ /** Orientation */
26
+ orientation: PaperOrientation;
27
+ /** Default printable margin in mm */
28
+ defaultMarginMm: number;
29
+ }
30
+ /** All supported paper sizes */
31
+ export declare const PAPER_SIZE_REGISTRY: Record<string, PaperSizeDefinition>;
32
+ /** Get paper sizes grouped by category */
33
+ export declare function getPaperSizesByCategory(): Record<PaperSizeCategory, PaperSizeDefinition[]>;
34
+ /** Get default paper size (A3 Landscape) */
35
+ export declare function getDefaultPaperSize(): PaperSizeDefinition;
36
+ //# sourceMappingURL=paper-sizes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paper-sizes.d.ts","sourceRoot":"","sources":["../../src/sheet/paper-sizes.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,wBAAwB;AACxB,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,WAAW,CAAC;AAExD,6CAA6C;AAC7C,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEnE,qCAAqC;AACrC,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,gCAAgC;AAChC,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAuOnE,CAAC;AAEF,0CAA0C;AAC1C,wBAAgB,uBAAuB,IAAI,MAAM,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,CAAC,CAW1F;AAED,4CAA4C;AAC5C,wBAAgB,mBAAmB,IAAI,mBAAmB,CAEzD"}
@@ -0,0 +1,252 @@
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
+ /** All supported paper sizes */
5
+ export const PAPER_SIZE_REGISTRY = {
6
+ // ISO A-Series
7
+ A0_LANDSCAPE: {
8
+ id: 'A0_LANDSCAPE',
9
+ name: 'A0 Landscape',
10
+ category: 'ISO',
11
+ widthMm: 1189,
12
+ heightMm: 841,
13
+ orientation: 'landscape',
14
+ defaultMarginMm: 20,
15
+ },
16
+ A0_PORTRAIT: {
17
+ id: 'A0_PORTRAIT',
18
+ name: 'A0 Portrait',
19
+ category: 'ISO',
20
+ widthMm: 841,
21
+ heightMm: 1189,
22
+ orientation: 'portrait',
23
+ defaultMarginMm: 20,
24
+ },
25
+ A1_LANDSCAPE: {
26
+ id: 'A1_LANDSCAPE',
27
+ name: 'A1 Landscape',
28
+ category: 'ISO',
29
+ widthMm: 841,
30
+ heightMm: 594,
31
+ orientation: 'landscape',
32
+ defaultMarginMm: 20,
33
+ },
34
+ A1_PORTRAIT: {
35
+ id: 'A1_PORTRAIT',
36
+ name: 'A1 Portrait',
37
+ category: 'ISO',
38
+ widthMm: 594,
39
+ heightMm: 841,
40
+ orientation: 'portrait',
41
+ defaultMarginMm: 20,
42
+ },
43
+ A2_LANDSCAPE: {
44
+ id: 'A2_LANDSCAPE',
45
+ name: 'A2 Landscape',
46
+ category: 'ISO',
47
+ widthMm: 594,
48
+ heightMm: 420,
49
+ orientation: 'landscape',
50
+ defaultMarginMm: 15,
51
+ },
52
+ A2_PORTRAIT: {
53
+ id: 'A2_PORTRAIT',
54
+ name: 'A2 Portrait',
55
+ category: 'ISO',
56
+ widthMm: 420,
57
+ heightMm: 594,
58
+ orientation: 'portrait',
59
+ defaultMarginMm: 15,
60
+ },
61
+ A3_LANDSCAPE: {
62
+ id: 'A3_LANDSCAPE',
63
+ name: 'A3 Landscape',
64
+ category: 'ISO',
65
+ widthMm: 420,
66
+ heightMm: 297,
67
+ orientation: 'landscape',
68
+ defaultMarginMm: 10,
69
+ },
70
+ A3_PORTRAIT: {
71
+ id: 'A3_PORTRAIT',
72
+ name: 'A3 Portrait',
73
+ category: 'ISO',
74
+ widthMm: 297,
75
+ heightMm: 420,
76
+ orientation: 'portrait',
77
+ defaultMarginMm: 10,
78
+ },
79
+ A4_LANDSCAPE: {
80
+ id: 'A4_LANDSCAPE',
81
+ name: 'A4 Landscape',
82
+ category: 'ISO',
83
+ widthMm: 297,
84
+ heightMm: 210,
85
+ orientation: 'landscape',
86
+ defaultMarginMm: 10,
87
+ },
88
+ A4_PORTRAIT: {
89
+ id: 'A4_PORTRAIT',
90
+ name: 'A4 Portrait',
91
+ category: 'ISO',
92
+ widthMm: 210,
93
+ heightMm: 297,
94
+ orientation: 'portrait',
95
+ defaultMarginMm: 10,
96
+ },
97
+ // US ANSI Series
98
+ LETTER_LANDSCAPE: {
99
+ id: 'LETTER_LANDSCAPE',
100
+ name: 'US Letter Landscape',
101
+ category: 'ANSI',
102
+ widthMm: 279.4,
103
+ heightMm: 215.9,
104
+ orientation: 'landscape',
105
+ defaultMarginMm: 10,
106
+ },
107
+ LETTER_PORTRAIT: {
108
+ id: 'LETTER_PORTRAIT',
109
+ name: 'US Letter Portrait',
110
+ category: 'ANSI',
111
+ widthMm: 215.9,
112
+ heightMm: 279.4,
113
+ orientation: 'portrait',
114
+ defaultMarginMm: 10,
115
+ },
116
+ LEGAL_LANDSCAPE: {
117
+ id: 'LEGAL_LANDSCAPE',
118
+ name: 'US Legal Landscape',
119
+ category: 'ANSI',
120
+ widthMm: 355.6,
121
+ heightMm: 215.9,
122
+ orientation: 'landscape',
123
+ defaultMarginMm: 10,
124
+ },
125
+ LEGAL_PORTRAIT: {
126
+ id: 'LEGAL_PORTRAIT',
127
+ name: 'US Legal Portrait',
128
+ category: 'ANSI',
129
+ widthMm: 215.9,
130
+ heightMm: 355.6,
131
+ orientation: 'portrait',
132
+ defaultMarginMm: 10,
133
+ },
134
+ TABLOID_LANDSCAPE: {
135
+ id: 'TABLOID_LANDSCAPE',
136
+ name: 'US Tabloid Landscape',
137
+ category: 'ANSI',
138
+ widthMm: 431.8,
139
+ heightMm: 279.4,
140
+ orientation: 'landscape',
141
+ defaultMarginMm: 15,
142
+ },
143
+ TABLOID_PORTRAIT: {
144
+ id: 'TABLOID_PORTRAIT',
145
+ name: 'US Tabloid Portrait',
146
+ category: 'ANSI',
147
+ widthMm: 279.4,
148
+ heightMm: 431.8,
149
+ orientation: 'portrait',
150
+ defaultMarginMm: 15,
151
+ },
152
+ ANSI_C: {
153
+ id: 'ANSI_C',
154
+ name: 'ANSI C (17x22)',
155
+ category: 'ANSI',
156
+ widthMm: 558.8,
157
+ heightMm: 431.8,
158
+ orientation: 'landscape',
159
+ defaultMarginMm: 15,
160
+ },
161
+ ANSI_D: {
162
+ id: 'ANSI_D',
163
+ name: 'ANSI D (22x34)',
164
+ category: 'ANSI',
165
+ widthMm: 863.6,
166
+ heightMm: 558.8,
167
+ orientation: 'landscape',
168
+ defaultMarginMm: 20,
169
+ },
170
+ ANSI_E: {
171
+ id: 'ANSI_E',
172
+ name: 'ANSI E (34x44)',
173
+ category: 'ANSI',
174
+ widthMm: 1117.6,
175
+ heightMm: 863.6,
176
+ orientation: 'landscape',
177
+ defaultMarginMm: 20,
178
+ },
179
+ // ARCH Series (Architectural)
180
+ ARCH_A: {
181
+ id: 'ARCH_A',
182
+ name: 'ARCH A (9x12)',
183
+ category: 'ARCH',
184
+ widthMm: 304.8,
185
+ heightMm: 228.6,
186
+ orientation: 'landscape',
187
+ defaultMarginMm: 10,
188
+ },
189
+ ARCH_B: {
190
+ id: 'ARCH_B',
191
+ name: 'ARCH B (12x18)',
192
+ category: 'ARCH',
193
+ widthMm: 457.2,
194
+ heightMm: 304.8,
195
+ orientation: 'landscape',
196
+ defaultMarginMm: 15,
197
+ },
198
+ ARCH_C: {
199
+ id: 'ARCH_C',
200
+ name: 'ARCH C (18x24)',
201
+ category: 'ARCH',
202
+ widthMm: 609.6,
203
+ heightMm: 457.2,
204
+ orientation: 'landscape',
205
+ defaultMarginMm: 15,
206
+ },
207
+ ARCH_D: {
208
+ id: 'ARCH_D',
209
+ name: 'ARCH D (24x36)',
210
+ category: 'ARCH',
211
+ widthMm: 914.4,
212
+ heightMm: 609.6,
213
+ orientation: 'landscape',
214
+ defaultMarginMm: 20,
215
+ },
216
+ ARCH_E: {
217
+ id: 'ARCH_E',
218
+ name: 'ARCH E (36x48)',
219
+ category: 'ARCH',
220
+ widthMm: 1219.2,
221
+ heightMm: 914.4,
222
+ orientation: 'landscape',
223
+ defaultMarginMm: 20,
224
+ },
225
+ ARCH_E1: {
226
+ id: 'ARCH_E1',
227
+ name: 'ARCH E1 (30x42)',
228
+ category: 'ARCH',
229
+ widthMm: 1066.8,
230
+ heightMm: 762,
231
+ orientation: 'landscape',
232
+ defaultMarginMm: 20,
233
+ },
234
+ };
235
+ /** Get paper sizes grouped by category */
236
+ export function getPaperSizesByCategory() {
237
+ const result = {
238
+ ISO: [],
239
+ ANSI: [],
240
+ ARCH: [],
241
+ custom: [],
242
+ };
243
+ for (const paper of Object.values(PAPER_SIZE_REGISTRY)) {
244
+ result[paper.category].push(paper);
245
+ }
246
+ return result;
247
+ }
248
+ /** Get default paper size (A3 Landscape) */
249
+ export function getDefaultPaperSize() {
250
+ return PAPER_SIZE_REGISTRY.A3_LANDSCAPE;
251
+ }
252
+ //# sourceMappingURL=paper-sizes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paper-sizes.js","sourceRoot":"","sources":["../../src/sheet/paper-sizes.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAmC/D,gCAAgC;AAChC,MAAM,CAAC,MAAM,mBAAmB,GAAwC;IACtE,eAAe;IACf,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,GAAG;QACb,WAAW,EAAE,WAAW;QACxB,eAAe,EAAE,EAAE;KACpB;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,GAAG;QACZ,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,UAAU;QACvB,eAAe,EAAE,EAAE;KACpB;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,GAAG;QACZ,QAAQ,EAAE,GAAG;QACb,WAAW,EAAE,WAAW;QACxB,eAAe,EAAE,EAAE;KACpB;IACD,WAAW,EAAE;QACX,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AM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,gBAAgB;QACtB,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,WAAW;QACxB,eAAe,EAAE,EAAE;KACpB;IACD,MAAM,EAAE;QACN,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,gBAAgB;QACtB,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,WAAW;QACxB,eAAe,EAAE,EAAE;KACpB;IACD,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,MAAM;QAChB,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,GAAG;QACb,WAAW,EAAE,WAAW;QACxB,eAAe,EAAE,EAAE;KACpB;CACF,CAAC;AAEF,0CAA0C;AAC1C,MAAM,UAAU,uBAAuB;IACrC,MAAM,MAAM,GAAqD;QAC/D,GAAG,EAAE,EAAE;QACP,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE;KACX,CAAC;IACF,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACvD,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,4CAA4C;AAC5C,MAAM,UAAU,mBAAmB;IACjC,OAAO,mBAAmB,CAAC,YAAY,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Scale Bar Renderer - Generates SVG for scale bars and north arrows
3
+ *
4
+ * Renders:
5
+ * - Alternating or linear scale bars
6
+ * - Division labels
7
+ * - Unit labels
8
+ * - North arrow symbols
9
+ */
10
+ import type { ScaleBarConfig, NorthArrowConfig } from './scale-bar-types';
11
+ import type { DrawingScale } from '../styles';
12
+ /** Position in paper coordinates (mm) */
13
+ export interface PositionMm {
14
+ x: number;
15
+ y: number;
16
+ }
17
+ /**
18
+ * Render a scale bar to SVG
19
+ *
20
+ * @param config - Scale bar configuration
21
+ * @param scale - Drawing scale
22
+ * @param positionMm - Position in paper coordinates (mm)
23
+ */
24
+ export declare function renderScaleBar(config: ScaleBarConfig, scale: DrawingScale, positionMm: PositionMm): string;
25
+ /**
26
+ * Render a north arrow to SVG
27
+ */
28
+ export declare function renderNorthArrow(config: NorthArrowConfig, positionMm: PositionMm): string;
29
+ //# sourceMappingURL=scale-bar-renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scale-bar-renderer.d.ts","sourceRoot":"","sources":["../../src/sheet/scale-bar-renderer.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C,yCAAyC;AACzC,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,UAAU,GACrB,MAAM,CAqCR;AA8MD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,UAAU,GACrB,MAAM,CA0BR"}
@@ -0,0 +1,287 @@
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
+ * Render a scale bar to SVG
6
+ *
7
+ * @param config - Scale bar configuration
8
+ * @param scale - Drawing scale
9
+ * @param positionMm - Position in paper coordinates (mm)
10
+ */
11
+ export function renderScaleBar(config, scale, positionMm) {
12
+ if (!config.visible)
13
+ return '';
14
+ let svg = ' <g id="scale-bar">\n';
15
+ // Calculate bar dimensions on paper
16
+ // totalLengthM is in model units (meters)
17
+ // At 1:100 scale, 1 meter = 10mm on paper
18
+ const paperScale = 1000 / scale.factor;
19
+ const barLengthMm = config.totalLengthM * paperScale;
20
+ const divisionLengthMm = barLengthMm / config.primaryDivisions;
21
+ const x = positionMm.x;
22
+ const y = positionMm.y;
23
+ switch (config.style) {
24
+ case 'alternating':
25
+ svg += renderAlternatingBar(config, x, y, barLengthMm, divisionLengthMm);
26
+ break;
27
+ case 'linear':
28
+ svg += renderLinearBar(config, x, y, barLengthMm, divisionLengthMm);
29
+ break;
30
+ case 'single':
31
+ svg += renderSingleBar(config, x, y, barLengthMm);
32
+ break;
33
+ case 'graphic':
34
+ svg += renderGraphicBar(config, x, y, barLengthMm, divisionLengthMm);
35
+ break;
36
+ default:
37
+ svg += renderAlternatingBar(config, x, y, barLengthMm, divisionLengthMm);
38
+ }
39
+ // Labels
40
+ svg += renderScaleBarLabels(config, x, y, barLengthMm, divisionLengthMm);
41
+ svg += ' </g>\n';
42
+ return svg;
43
+ }
44
+ /**
45
+ * Render alternating black/white bar style
46
+ */
47
+ function renderAlternatingBar(config, x, y, barLengthMm, divisionLengthMm) {
48
+ let svg = '';
49
+ // Draw divisions
50
+ for (let i = 0; i < config.primaryDivisions; i++) {
51
+ const divX = x + i * divisionLengthMm;
52
+ const fill = i % 2 === 0 ? config.fillColor : '#FFFFFF';
53
+ svg += ` <rect x="${divX.toFixed(2)}" y="${y.toFixed(2)}" `;
54
+ svg += `width="${divisionLengthMm.toFixed(2)}" height="${config.heightMm.toFixed(2)}" `;
55
+ svg += `fill="${fill}" stroke="${config.strokeColor}" stroke-width="${config.lineWeight}"/>\n`;
56
+ }
57
+ // Subdivisions on first division
58
+ if (config.subdivisions > 1) {
59
+ const subLength = divisionLengthMm / config.subdivisions;
60
+ for (let j = 1; j < config.subdivisions; j++) {
61
+ const subX = x + j * subLength;
62
+ const subFill = j % 2 === 0 ? config.fillColor : '#FFFFFF';
63
+ // Smaller sub-bar above main bar
64
+ svg += ` <rect x="${subX.toFixed(2)}" y="${(y - config.heightMm * 0.5).toFixed(2)}" `;
65
+ svg += `width="${subLength.toFixed(2)}" height="${(config.heightMm * 0.5).toFixed(2)}" `;
66
+ svg += `fill="${subFill}" stroke="${config.strokeColor}" stroke-width="${config.lineWeight * 0.7}"/>\n`;
67
+ }
68
+ // Zero marker sub-bar
69
+ svg += ` <rect x="${x.toFixed(2)}" y="${(y - config.heightMm * 0.5).toFixed(2)}" `;
70
+ svg += `width="${subLength.toFixed(2)}" height="${(config.heightMm * 0.5).toFixed(2)}" `;
71
+ svg += `fill="${config.fillColor}" stroke="${config.strokeColor}" stroke-width="${config.lineWeight * 0.7}"/>\n`;
72
+ }
73
+ return svg;
74
+ }
75
+ /**
76
+ * Render linear (lines only) bar style
77
+ */
78
+ function renderLinearBar(config, x, y, barLengthMm, divisionLengthMm) {
79
+ let svg = '';
80
+ // Main horizontal line
81
+ svg += ` <line x1="${x.toFixed(2)}" y1="${(y + config.heightMm / 2).toFixed(2)}" `;
82
+ svg += `x2="${(x + barLengthMm).toFixed(2)}" y2="${(y + config.heightMm / 2).toFixed(2)}" `;
83
+ svg += `stroke="${config.strokeColor}" stroke-width="${config.lineWeight}"/>\n`;
84
+ // Division ticks
85
+ for (let i = 0; i <= config.primaryDivisions; i++) {
86
+ const tickX = x + i * divisionLengthMm;
87
+ svg += ` <line x1="${tickX.toFixed(2)}" y1="${y.toFixed(2)}" `;
88
+ svg += `x2="${tickX.toFixed(2)}" y2="${(y + config.heightMm).toFixed(2)}" `;
89
+ svg += `stroke="${config.strokeColor}" stroke-width="${config.lineWeight}"/>\n`;
90
+ }
91
+ // Subdivisions
92
+ if (config.subdivisions > 1) {
93
+ const subLength = divisionLengthMm / config.subdivisions;
94
+ for (let j = 1; j < config.subdivisions; j++) {
95
+ const subX = x + j * subLength;
96
+ svg += ` <line x1="${subX.toFixed(2)}" y1="${y.toFixed(2)}" `;
97
+ svg += `x2="${subX.toFixed(2)}" y2="${(y + config.heightMm * 0.6).toFixed(2)}" `;
98
+ svg += `stroke="${config.strokeColor}" stroke-width="${config.lineWeight * 0.7}"/>\n`;
99
+ }
100
+ }
101
+ return svg;
102
+ }
103
+ /**
104
+ * Render simple single bar style
105
+ */
106
+ function renderSingleBar(config, x, y, barLengthMm) {
107
+ let svg = '';
108
+ // Single solid bar
109
+ svg += ` <rect x="${x.toFixed(2)}" y="${y.toFixed(2)}" `;
110
+ svg += `width="${barLengthMm.toFixed(2)}" height="${config.heightMm.toFixed(2)}" `;
111
+ svg += `fill="${config.fillColor}" stroke="${config.strokeColor}" stroke-width="${config.lineWeight}"/>\n`;
112
+ // End ticks
113
+ svg += ` <line x1="${x.toFixed(2)}" y1="${(y - 1).toFixed(2)}" `;
114
+ svg += `x2="${x.toFixed(2)}" y2="${(y + config.heightMm + 1).toFixed(2)}" `;
115
+ svg += `stroke="${config.strokeColor}" stroke-width="${config.lineWeight}"/>\n`;
116
+ svg += ` <line x1="${(x + barLengthMm).toFixed(2)}" y1="${(y - 1).toFixed(2)}" `;
117
+ svg += `x2="${(x + barLengthMm).toFixed(2)}" y2="${(y + config.heightMm + 1).toFixed(2)}" `;
118
+ svg += `stroke="${config.strokeColor}" stroke-width="${config.lineWeight}"/>\n`;
119
+ return svg;
120
+ }
121
+ /**
122
+ * Render graphic/decorative bar style
123
+ */
124
+ function renderGraphicBar(config, x, y, barLengthMm, divisionLengthMm) {
125
+ let svg = '';
126
+ // Outer frame
127
+ svg += ` <rect x="${(x - 0.5).toFixed(2)}" y="${(y - 0.5).toFixed(2)}" `;
128
+ svg += `width="${(barLengthMm + 1).toFixed(2)}" height="${(config.heightMm + 1).toFixed(2)}" `;
129
+ svg += `fill="none" stroke="${config.strokeColor}" stroke-width="${config.lineWeight}"/>\n`;
130
+ // Alternating triangular pattern
131
+ for (let i = 0; i < config.primaryDivisions; i++) {
132
+ const divX = x + i * divisionLengthMm;
133
+ if (i % 2 === 0) {
134
+ // Solid fill
135
+ svg += ` <rect x="${divX.toFixed(2)}" y="${y.toFixed(2)}" `;
136
+ svg += `width="${divisionLengthMm.toFixed(2)}" height="${config.heightMm.toFixed(2)}" `;
137
+ svg += `fill="${config.fillColor}"/>\n`;
138
+ }
139
+ else {
140
+ // Diagonal hatch pattern
141
+ svg += ` <rect x="${divX.toFixed(2)}" y="${y.toFixed(2)}" `;
142
+ svg += `width="${divisionLengthMm.toFixed(2)}" height="${config.heightMm.toFixed(2)}" `;
143
+ svg += `fill="#FFFFFF" stroke="${config.strokeColor}" stroke-width="${config.lineWeight * 0.5}"/>\n`;
144
+ // Diagonal lines
145
+ const numLines = 3;
146
+ for (let l = 0; l < numLines; l++) {
147
+ const lineOffset = (divisionLengthMm / numLines) * (l + 0.5);
148
+ svg += ` <line x1="${(divX + lineOffset).toFixed(2)}" y1="${y.toFixed(2)}" `;
149
+ svg += `x2="${(divX + lineOffset - config.heightMm).toFixed(2)}" y2="${(y + config.heightMm).toFixed(2)}" `;
150
+ svg += `stroke="${config.strokeColor}" stroke-width="${config.lineWeight * 0.3}"/>\n`;
151
+ }
152
+ }
153
+ }
154
+ return svg;
155
+ }
156
+ /**
157
+ * Render scale bar labels
158
+ */
159
+ function renderScaleBarLabels(config, x, y, barLengthMm, divisionLengthMm) {
160
+ let svg = '';
161
+ const labelY = y + config.heightMm + config.labelFontSize + 1;
162
+ // Zero label
163
+ svg += ` <text x="${x.toFixed(2)}" y="${labelY.toFixed(2)}" `;
164
+ svg += `font-family="Arial, sans-serif" font-size="${config.labelFontSize}" `;
165
+ svg += `text-anchor="middle" fill="#000000">0</text>\n`;
166
+ // Division labels (only show first, middle, and last to avoid clutter)
167
+ const labelsToShow = [config.primaryDivisions];
168
+ if (config.primaryDivisions > 2) {
169
+ labelsToShow.unshift(Math.floor(config.primaryDivisions / 2));
170
+ }
171
+ const divisionValue = config.totalLengthM / config.primaryDivisions;
172
+ for (const i of labelsToShow) {
173
+ const labelX = x + i * divisionLengthMm;
174
+ const numValue = divisionValue * i;
175
+ const value = numValue.toFixed(numValue >= 10 ? 0 : 1);
176
+ svg += ` <text x="${labelX.toFixed(2)}" y="${labelY.toFixed(2)}" `;
177
+ svg += `font-family="Arial, sans-serif" font-size="${config.labelFontSize}" `;
178
+ svg += `text-anchor="middle" fill="#000000">${value}</text>\n`;
179
+ }
180
+ // Unit label
181
+ if (config.showUnitLabel) {
182
+ const unitLabel = config.units === 'imperial' ? 'ft' : 'm';
183
+ svg += ` <text x="${(x + barLengthMm + config.labelFontSize).toFixed(2)}" y="${labelY.toFixed(2)}" `;
184
+ svg += `font-family="Arial, sans-serif" font-size="${config.labelFontSize}" `;
185
+ svg += `fill="#000000">${unitLabel}</text>\n`;
186
+ }
187
+ return svg;
188
+ }
189
+ /**
190
+ * Render a north arrow to SVG
191
+ */
192
+ export function renderNorthArrow(config, positionMm) {
193
+ if (config.style === 'none')
194
+ return '';
195
+ let svg = ' <g id="north-arrow">\n';
196
+ svg += ` <g transform="translate(${positionMm.x.toFixed(2)}, ${positionMm.y.toFixed(2)}) rotate(${config.rotation})">\n`;
197
+ const size = config.sizeMm;
198
+ const halfSize = size / 2;
199
+ switch (config.style) {
200
+ case 'simple':
201
+ svg += renderSimpleNorthArrow(halfSize);
202
+ break;
203
+ case 'compass':
204
+ svg += renderCompassNorthArrow(halfSize);
205
+ break;
206
+ case 'decorative':
207
+ svg += renderDecorativeNorthArrow(halfSize);
208
+ break;
209
+ default:
210
+ svg += renderSimpleNorthArrow(halfSize);
211
+ }
212
+ svg += ' </g>\n';
213
+ svg += ' </g>\n';
214
+ return svg;
215
+ }
216
+ /**
217
+ * Simple arrow style
218
+ */
219
+ function renderSimpleNorthArrow(halfSize) {
220
+ let svg = '';
221
+ // Arrow body (triangle pointing up)
222
+ svg += ` <polygon points="0,${-halfSize} ${halfSize * 0.4},${halfSize * 0.6} ${-halfSize * 0.4},${halfSize * 0.6}" `;
223
+ svg += `fill="#000000" stroke="#000000" stroke-width="0.3"/>\n`;
224
+ // "N" label
225
+ svg += ` <text x="0" y="${(-halfSize - 2).toFixed(2)}" `;
226
+ svg += `font-family="Arial, sans-serif" font-size="${(halfSize * 0.5).toFixed(2)}" `;
227
+ svg += `text-anchor="middle" font-weight="bold" fill="#000000">N</text>\n`;
228
+ return svg;
229
+ }
230
+ /**
231
+ * Compass rose style
232
+ */
233
+ function renderCompassNorthArrow(halfSize) {
234
+ let svg = '';
235
+ // Circle
236
+ svg += ` <circle cx="0" cy="0" r="${halfSize.toFixed(2)}" `;
237
+ svg += `fill="none" stroke="#000000" stroke-width="0.3"/>\n`;
238
+ // North pointer (filled triangle)
239
+ svg += ` <polygon points="0,${-halfSize * 0.9} ${halfSize * 0.2},0 ${-halfSize * 0.2},0" `;
240
+ svg += `fill="#000000"/>\n`;
241
+ // South pointer (outline only)
242
+ svg += ` <polygon points="0,${halfSize * 0.9} ${halfSize * 0.2},0 ${-halfSize * 0.2},0" `;
243
+ svg += `fill="none" stroke="#000000" stroke-width="0.3"/>\n`;
244
+ // East/West points
245
+ svg += ` <line x1="${halfSize * 0.5}" y1="0" x2="${halfSize * 0.9}" y2="0" `;
246
+ svg += `stroke="#000000" stroke-width="0.3"/>\n`;
247
+ svg += ` <line x1="${-halfSize * 0.5}" y1="0" x2="${-halfSize * 0.9}" y2="0" `;
248
+ svg += `stroke="#000000" stroke-width="0.3"/>\n`;
249
+ // "N" label
250
+ svg += ` <text x="0" y="${(-halfSize - 2).toFixed(2)}" `;
251
+ svg += `font-family="Arial, sans-serif" font-size="${(halfSize * 0.4).toFixed(2)}" `;
252
+ svg += `text-anchor="middle" font-weight="bold" fill="#000000">N</text>\n`;
253
+ return svg;
254
+ }
255
+ /**
256
+ * Decorative/ornate style
257
+ */
258
+ function renderDecorativeNorthArrow(halfSize) {
259
+ let svg = '';
260
+ // Outer circle
261
+ svg += ` <circle cx="0" cy="0" r="${halfSize.toFixed(2)}" `;
262
+ svg += `fill="none" stroke="#000000" stroke-width="0.4"/>\n`;
263
+ // Inner circle
264
+ svg += ` <circle cx="0" cy="0" r="${(halfSize * 0.3).toFixed(2)}" `;
265
+ svg += `fill="#000000"/>\n`;
266
+ // Four-pointed star
267
+ const pts = [
268
+ `0,${-halfSize * 0.95}`,
269
+ `${halfSize * 0.15},${-halfSize * 0.15}`,
270
+ `${halfSize * 0.95},0`,
271
+ `${halfSize * 0.15},${halfSize * 0.15}`,
272
+ `0,${halfSize * 0.95}`,
273
+ `${-halfSize * 0.15},${halfSize * 0.15}`,
274
+ `${-halfSize * 0.95},0`,
275
+ `${-halfSize * 0.15},${-halfSize * 0.15}`,
276
+ ].join(' ');
277
+ svg += ` <polygon points="${pts}" fill="none" stroke="#000000" stroke-width="0.3"/>\n`;
278
+ // North half filled
279
+ svg += ` <polygon points="0,${-halfSize * 0.95} ${halfSize * 0.15},${-halfSize * 0.15} 0,0 ${-halfSize * 0.15},${-halfSize * 0.15}" `;
280
+ svg += `fill="#000000"/>\n`;
281
+ // "N" label
282
+ svg += ` <text x="0" y="${(-halfSize - 2).toFixed(2)}" `;
283
+ svg += `font-family="Arial, sans-serif" font-size="${(halfSize * 0.35).toFixed(2)}" `;
284
+ svg += `text-anchor="middle" font-weight="bold" fill="#000000">N</text>\n`;
285
+ return svg;
286
+ }
287
+ //# sourceMappingURL=scale-bar-renderer.js.map