@linkiez/dxf-renew 5.3.1 → 7.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 (133) hide show
  1. package/{docs/CODE_PATTERNS.md → .github/instructions/code-patterns.instructions.md} +4 -1
  2. package/.github/instructions/exdxf.instruction.md +161 -0
  3. package/.github/instructions/tdd.instructions.md +271 -0
  4. package/.github/workflows/release.yml +4 -5
  5. package/.releaserc.json +1 -1
  6. package/.yarn/install-state.gz +0 -0
  7. package/CHANGELOG.md +59 -0
  8. package/CONTRIBUTING.md +16 -14
  9. package/PLAN.md +34 -84
  10. package/README.md +43 -8
  11. package/dist/dxf.js +1388 -376
  12. package/docs/DIMENSION_SUMMARY.md +11 -5
  13. package/docs/DXF_VERSION_SUPPORT.md +45 -0
  14. package/docs/ENTITY_SVG_ROADMAP.md +96 -0
  15. package/docs/EZDXF_REFERENCE_SITEMAP.md +55 -0
  16. package/docs/FIXTURE_VALIDATION_EZDXF.md +62 -0
  17. package/docs/README.md +22 -0
  18. package/docs/SVG_RENDERING_INTEGRATION_TESTS.md +119 -0
  19. package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.md +1 -1
  20. package/lib/Helper.cjs +2 -2
  21. package/lib/Helper.cjs.map +2 -2
  22. package/lib/Helper.js +2 -2
  23. package/lib/Helper.js.map +2 -2
  24. package/lib/denormalise.cjs +131 -91
  25. package/lib/denormalise.cjs.map +2 -2
  26. package/lib/denormalise.js +131 -91
  27. package/lib/denormalise.js.map +2 -2
  28. package/lib/dimensionToSVG.cjs +318 -53
  29. package/lib/dimensionToSVG.cjs.map +3 -3
  30. package/lib/dimensionToSVG.js +316 -52
  31. package/lib/dimensionToSVG.js.map +2 -2
  32. package/lib/handlers/entities.cjs +90 -26
  33. package/lib/handlers/entities.cjs.map +3 -3
  34. package/lib/handlers/entities.js +90 -26
  35. package/lib/handlers/entities.js.map +3 -3
  36. package/lib/handlers/entity/dgnUnderlay.cjs +106 -0
  37. package/lib/handlers/entity/dgnUnderlay.cjs.map +7 -0
  38. package/lib/handlers/entity/dgnUnderlay.js +71 -0
  39. package/lib/handlers/entity/dgnUnderlay.js.map +7 -0
  40. package/lib/handlers/entity/dimension.cjs +24 -0
  41. package/lib/handlers/entity/dimension.cjs.map +2 -2
  42. package/lib/handlers/entity/dimension.js +24 -0
  43. package/lib/handlers/entity/dimension.js.map +2 -2
  44. package/lib/handlers/entity/dwfUnderlay.cjs +106 -0
  45. package/lib/handlers/entity/dwfUnderlay.cjs.map +7 -0
  46. package/lib/handlers/entity/dwfUnderlay.js +71 -0
  47. package/lib/handlers/entity/dwfUnderlay.js.map +7 -0
  48. package/lib/handlers/entity/image.cjs +123 -0
  49. package/lib/handlers/entity/image.cjs.map +7 -0
  50. package/lib/handlers/entity/image.js +88 -0
  51. package/lib/handlers/entity/image.js.map +7 -0
  52. package/lib/handlers/entity/leader.cjs +148 -0
  53. package/lib/handlers/entity/leader.cjs.map +7 -0
  54. package/lib/handlers/entity/leader.js +113 -0
  55. package/lib/handlers/entity/leader.js.map +7 -0
  56. package/lib/handlers/entity/pdfUnderlay.cjs +106 -0
  57. package/lib/handlers/entity/pdfUnderlay.cjs.map +7 -0
  58. package/lib/handlers/entity/pdfUnderlay.js +71 -0
  59. package/lib/handlers/entity/pdfUnderlay.js.map +7 -0
  60. package/lib/handlers/entity/tolerance.cjs +90 -0
  61. package/lib/handlers/entity/tolerance.cjs.map +7 -0
  62. package/lib/handlers/entity/tolerance.js +55 -0
  63. package/lib/handlers/entity/tolerance.js.map +7 -0
  64. package/lib/handlers/objects.cjs +257 -136
  65. package/lib/handlers/objects.cjs.map +2 -2
  66. package/lib/handlers/objects.js +257 -136
  67. package/lib/handlers/objects.js.map +2 -2
  68. package/lib/toSVG.cjs +71 -8
  69. package/lib/toSVG.cjs.map +3 -3
  70. package/lib/toSVG.js +72 -9
  71. package/lib/toSVG.js.map +2 -2
  72. package/lib/types/dimension-entity.cjs.map +1 -1
  73. package/lib/types/entity.cjs.map +1 -1
  74. package/lib/types/image-entity.cjs +17 -0
  75. package/lib/types/image-entity.cjs.map +7 -0
  76. package/lib/types/image-entity.js +1 -0
  77. package/lib/types/image-entity.js.map +7 -0
  78. package/lib/types/index.cjs +8 -0
  79. package/lib/types/index.cjs.map +2 -2
  80. package/lib/types/index.js +4 -0
  81. package/lib/types/index.js.map +2 -2
  82. package/lib/types/leader-entity.cjs +17 -0
  83. package/lib/types/leader-entity.cjs.map +7 -0
  84. package/lib/types/leader-entity.js +1 -0
  85. package/lib/types/leader-entity.js.map +7 -0
  86. package/lib/types/options.cjs.map +1 -1
  87. package/lib/types/tables.cjs.map +1 -1
  88. package/lib/types/tolerance-entity.cjs +17 -0
  89. package/lib/types/tolerance-entity.cjs.map +7 -0
  90. package/lib/types/tolerance-entity.js +1 -0
  91. package/lib/types/tolerance-entity.js.map +7 -0
  92. package/lib/types/underlay-entity.cjs +17 -0
  93. package/lib/types/underlay-entity.cjs.map +7 -0
  94. package/lib/types/underlay-entity.js +1 -0
  95. package/lib/types/underlay-entity.js.map +7 -0
  96. package/lib/util/escapeXmlText.cjs +27 -0
  97. package/lib/util/escapeXmlText.cjs.map +7 -0
  98. package/lib/util/escapeXmlText.js +7 -0
  99. package/lib/util/escapeXmlText.js.map +7 -0
  100. package/package.json +13 -4
  101. package/playwright.config.cjs +20 -0
  102. package/src/Helper.ts +3 -3
  103. package/src/denormalise.ts +182 -116
  104. package/src/dimensionToSVG.ts +466 -54
  105. package/src/handlers/entities.ts +109 -34
  106. package/src/handlers/entity/dgnUnderlay.ts +94 -0
  107. package/src/handlers/entity/dimension.ts +27 -1
  108. package/src/handlers/entity/dwfUnderlay.ts +94 -0
  109. package/src/handlers/entity/image.ts +118 -0
  110. package/src/handlers/entity/leader.ts +153 -0
  111. package/src/handlers/entity/pdfUnderlay.ts +94 -0
  112. package/src/handlers/entity/tolerance.ts +75 -0
  113. package/src/handlers/objects.ts +323 -139
  114. package/src/toSVG.ts +98 -7
  115. package/src/types/dimension-entity.ts +11 -0
  116. package/src/types/entity.ts +10 -0
  117. package/src/types/image-entity.ts +35 -0
  118. package/src/types/index.ts +4 -0
  119. package/src/types/leader-entity.ts +40 -0
  120. package/src/types/options.ts +41 -0
  121. package/src/types/tables.ts +84 -0
  122. package/src/types/tolerance-entity.ts +20 -0
  123. package/src/types/underlay-entity.ts +35 -0
  124. package/src/util/escapeXmlText.ts +10 -0
  125. package/tools/browser_test_server.cjs +87 -0
  126. package/tools/ezdxf_generate_dimensions_all_types.py +246 -0
  127. package/tools/ezdxf_generate_dimensions_angular_3p.py +59 -0
  128. package/tools/ezdxf_generate_dimensions_large_scale.py +87 -0
  129. package/tools/ezdxf_regenerate_problem_fixtures.py +184 -0
  130. package/tools/ezdxf_validate_fixtures.py +165 -0
  131. package/docs/DIMENSION_SUMMARY.pt-BR.md +0 -248
  132. package/docs/IMPLEMENTED-2D-ENTITIES.pt-BR.md +0 -54
  133. package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.pt-BR.md +0 -169
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/dimensionToSVG.ts"],
4
- "sourcesContent": ["import { Box2 } from 'vecks'\n\nimport colors from './util/colors'\n\nimport type { DimensionEntity } from './types'\nimport type { DimStyleTable } from './types/dxf'\nimport type { BoundsAndElement } from './types/svg'\n\n/**\n * Convert DXF color number to SVG color string\n */\nfunction colorNumberToSVG(colorNumber?: number): string {\n if (colorNumber === undefined || colorNumber < 0) {\n return 'currentColor'\n }\n\n // DXF color 0 is ByBlock, 256 is ByLayer, 7 is white/black (depends on bg)\n if (colorNumber === 0 || colorNumber === 256) {\n return 'currentColor'\n }\n\n // Get RGB from color table\n const rgb = colors[colorNumber]\n if (!rgb) {\n return 'currentColor'\n }\n\n return `rgb(${rgb[0]},${rgb[1]},${rgb[2]})`\n}\n\n/**\n * Get dimension colors and weights from DIMSTYLE with defaults\n */\nfunction getDimensionColors(dimStyle?: DimStyleTable): {\n dimLineColor: string\n extLineColor: string\n textColor: string\n dimLineWeight: number\n extLineWeight: number\n} {\n return {\n dimLineColor: colorNumberToSVG(dimStyle?.dimClrd),\n extLineColor: colorNumberToSVG(dimStyle?.dimClre),\n textColor: colorNumberToSVG(dimStyle?.dimClrt),\n dimLineWeight: dimStyle?.dimLwd ?? 0.5,\n extLineWeight: dimStyle?.dimLwe ?? 0.5,\n }\n}\n\n/**\n * Render DIMENSION entity to SVG with proper DIMSTYLE support\n */\nexport default function dimensionToSVG(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n): BoundsAndElement {\n // Dispatch to appropriate renderer based on dimension type\n switch (entity.dimensionType) {\n case 0: // Rotated, horizontal, or vertical\n case 1: // Aligned\n return renderLinearDimension(entity, dimStyle)\n case 2: // Angular\n return renderAngularDimension(entity, dimStyle)\n case 3: // Diameter\n return renderDiameterDimension(entity, dimStyle)\n case 4: // Radius\n return renderRadialDimension(entity, dimStyle)\n case 6: // Ordinate\n return renderOrdinateDimension(entity, dimStyle)\n default:\n // Fallback to simple line rendering\n return renderFallbackDimension(entity)\n }\n}\n\n/**\n * Create SVG marker definition for dimension arrows\n */\nexport function createArrowMarker(\n id: string,\n size: number,\n color: string,\n): string {\n const arrowPath = `M 0 0 L ${size} ${size / 2} L 0 ${size} z`\n return `<marker id=\"${id}\" markerWidth=\"${size}\" markerHeight=\"${size}\" refX=\"${size}\" refY=\"${size / 2}\" orient=\"auto\" markerUnits=\"strokeWidth\">\n <path d=\"${arrowPath}\" fill=\"${color}\" />\n </marker>`\n}\n\n/**\n * Render linear dimension (rotated, horizontal, vertical, or aligned)\n */\nfunction renderLinearDimension(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n const markers: string[] = []\n\n // Get dimension style properties with defaults\n const arrowSize = dimStyle?.dimAsz ?? 2.5\n const textHeight = dimStyle?.dimTxt ?? 2.5\n const extLineOffset = dimStyle?.dimExo ?? 0.625\n const extLineExtension = dimStyle?.dimExe ?? 1.25\n const { dimLineColor, extLineColor, textColor, dimLineWeight, extLineWeight } = getDimensionColors(dimStyle)\n\n // Extract dimension geometry\n const defPoint1X = entity.measureStart?.x ?? 0\n const defPoint1Y = entity.measureStart?.y ?? 0\n const defPoint2X = entity.measureEnd?.x ?? 0\n const defPoint2Y = entity.measureEnd?.y ?? 0\n const dimLineY = entity.start?.y ?? 0\n const textX = entity.textMidpoint?.x ?? (defPoint1X + defPoint2X) / 2\n const textY = entity.textMidpoint?.y ?? (defPoint1Y + defPoint2Y) / 2\n\n // Calculate dimension line angle\n const angle = Math.atan2(defPoint2Y - defPoint1Y, defPoint2X - defPoint1X)\n const perpAngle = angle + Math.PI / 2\n\n // Calculate dimension line endpoints\n const dimLine1X = defPoint1X + Math.cos(perpAngle) * (dimLineY - defPoint1Y)\n const dimLine1Y = defPoint1Y + Math.sin(perpAngle) * (dimLineY - defPoint1Y)\n const dimLine2X = defPoint2X + Math.cos(perpAngle) * (dimLineY - defPoint2Y)\n const dimLine2Y = defPoint2Y + Math.sin(perpAngle) * (dimLineY - defPoint2Y)\n\n // Expand bounding box\n bbox.expandByPoint({ x: defPoint1X, y: defPoint1Y })\n bbox.expandByPoint({ x: defPoint2X, y: defPoint2Y })\n bbox.expandByPoint({ x: dimLine1X, y: dimLine1Y })\n bbox.expandByPoint({ x: dimLine2X, y: dimLine2Y })\n bbox.expandByPoint({ x: textX, y: textY })\n\n // Create unique marker IDs for arrows\n const markerId1 = `dim-arrow-start-${Date.now()}`\n const markerId2 = `dim-arrow-end-${Date.now()}`\n\n // Create arrow markers with dimension line color\n markers.push(\n createArrowMarker(markerId1, arrowSize, dimLineColor),\n createArrowMarker(markerId2, arrowSize, dimLineColor),\n )\n\n // Draw extension lines\n const extLine1StartX = defPoint1X + Math.cos(perpAngle) * extLineOffset\n const extLine1StartY = defPoint1Y + Math.sin(perpAngle) * extLineOffset\n const extLine1EndX = dimLine1X + Math.cos(perpAngle) * extLineExtension\n const extLine1EndY = dimLine1Y + Math.sin(perpAngle) * extLineExtension\n\n const extLine2StartX = defPoint2X + Math.cos(perpAngle) * extLineOffset\n const extLine2StartY = defPoint2Y + Math.sin(perpAngle) * extLineOffset\n const extLine2EndX = dimLine2X + Math.cos(perpAngle) * extLineExtension\n const extLine2EndY = dimLine2Y + Math.sin(perpAngle) * extLineExtension\n\n elements.push(\n `<line x1=\"${extLine1StartX}\" y1=\"${extLine1StartY}\" x2=\"${extLine1EndX}\" y2=\"${extLine1EndY}\" stroke=\"${extLineColor}\" stroke-width=\"${extLineWeight}\" />`,\n `<line x1=\"${extLine2StartX}\" y1=\"${extLine2StartY}\" x2=\"${extLine2EndX}\" y2=\"${extLine2EndY}\" stroke=\"${extLineColor}\" stroke-width=\"${extLineWeight}\" />`,\n `<line x1=\"${dimLine1X}\" y1=\"${dimLine1Y}\" x2=\"${dimLine2X}\" y2=\"${dimLine2Y}\" stroke=\"${dimLineColor}\" stroke-width=\"${dimLineWeight}\" marker-start=\"url(#${markerId1})\" marker-end=\"url(#${markerId2})\" />`,\n )\n\n // Add dimension text\n if (entity.text) {\n const textRotation = (angle * 180) / Math.PI\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"${textHeight}\" fill=\"${textColor}\" text-anchor=\"middle\" transform=\"rotate(${-textRotation} ${textX} ${textY}) scale(1,-1) translate(0 ${-2 * textY})\">${entity.text}</text>`,\n )\n }\n\n return {\n bbox,\n element: `<defs>${markers.join('')}</defs><g>${elements.join('')}</g>`,\n }\n}\n\n/**\n * Render angular dimension\n */\nfunction renderAngularDimension(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n const markers: string[] = []\n\n // Get dimension style properties\n const arrowSize = dimStyle?.dimAsz ?? 2.5\n const textHeight = dimStyle?.dimTxt ?? 2.5\n const { dimLineColor, extLineColor, textColor, dimLineWeight, extLineWeight } = getDimensionColors(dimStyle)\n\n // Extract points\n const centerX = entity.start?.x ?? 0\n const centerY = entity.start?.y ?? 0\n const x1 = entity.measureStart?.x ?? 0\n const y1 = entity.measureStart?.y ?? 0\n const x2 = entity.measureEnd?.x ?? 0\n const y2 = entity.measureEnd?.y ?? 0\n const textX = entity.textMidpoint?.x ?? centerX\n const textY = entity.textMidpoint?.y ?? centerY\n\n bbox.expandByPoint({ x: centerX, y: centerY })\n bbox.expandByPoint({ x: x1, y: y1 })\n bbox.expandByPoint({ x: x2, y: y2 })\n bbox.expandByPoint({ x: textX, y: textY })\n\n // Create arrow markers\n const markerId1 = `dim-angular-arrow-start-${Date.now()}`\n const markerId2 = `dim-angular-arrow-end-${Date.now()}`\n markers.push(\n createArrowMarker(markerId1, arrowSize, dimLineColor),\n createArrowMarker(markerId2, arrowSize, dimLineColor),\n )\n\n // Draw extension lines from center to definition points\n elements.push(\n `<line x1=\"${centerX}\" y1=\"${centerY}\" x2=\"${x1}\" y2=\"${y1}\" stroke=\"${extLineColor}\" stroke-width=\"${extLineWeight}\" />`,\n `<line x1=\"${centerX}\" y1=\"${centerY}\" x2=\"${x2}\" y2=\"${y2}\" stroke=\"${extLineColor}\" stroke-width=\"${extLineWeight}\" />`,\n )\n\n // Calculate arc radius (distance from center to text midpoint)\n const radius = Math.hypot(textX - centerX, textY - centerY)\n const startAngle = Math.atan2(y1 - centerY, x1 - centerX)\n const endAngle = Math.atan2(y2 - centerY, x2 - centerX)\n\n // Draw arc for angular dimension\n const largeArcFlag = Math.abs(endAngle - startAngle) > Math.PI ? 1 : 0\n const arcStartX = centerX + radius * Math.cos(startAngle)\n const arcStartY = centerY + radius * Math.sin(startAngle)\n const arcEndX = centerX + radius * Math.cos(endAngle)\n const arcEndY = centerY + radius * Math.sin(endAngle)\n\n elements.push(\n `<path d=\"M ${arcStartX} ${arcStartY} A ${radius} ${radius} 0 ${largeArcFlag} 1 ${arcEndX} ${arcEndY}\" fill=\"none\" stroke=\"${dimLineColor}\" stroke-width=\"${dimLineWeight}\" marker-start=\"url(#${markerId1})\" marker-end=\"url(#${markerId2})\" />`,\n )\n\n // Add dimension text\n if (entity.text) {\n const midAngle = (startAngle + endAngle) / 2\n const textRotation = (midAngle * 180) / Math.PI\n\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"${textHeight}\" fill=\"${textColor}\" text-anchor=\"middle\" transform=\"rotate(${-textRotation} ${textX} ${textY}) scale(1,-1) translate(0 ${-2 * textY})\">${entity.text}</text>`,\n )\n }\n\n return {\n bbox,\n element: `<defs>${markers.join('')}</defs><g>${elements.join('')}</g>`,\n }\n}\n\n/**\n * Render diameter dimension\n */\nfunction renderDiameterDimension(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n const markers: string[] = []\n\n // Get dimension style properties\n const arrowSize = dimStyle?.dimAsz ?? 2.5\n const textHeight = dimStyle?.dimTxt ?? 2.5\n const { dimLineColor, textColor, dimLineWeight } = getDimensionColors(dimStyle)\n\n // Extract geometry\n const x1 = entity.measureStart?.x ?? 0\n const y1 = entity.measureStart?.y ?? 0\n const x2 = entity.measureEnd?.x ?? 0\n const y2 = entity.measureEnd?.y ?? 0\n const textX = entity.textMidpoint?.x ?? (x1 + x2) / 2\n const textY = entity.textMidpoint?.y ?? (y1 + y2) / 2\n\n bbox.expandByPoint({ x: x1, y: y1 })\n bbox.expandByPoint({ x: x2, y: y2 })\n bbox.expandByPoint({ x: textX, y: textY })\n\n // Create arrow markers\n const markerId = `dim-diameter-arrow-${Date.now()}`\n markers.push(createArrowMarker(markerId, arrowSize, dimLineColor))\n\n // Create diameter line with arrow at the end\n elements.push(\n `<line x1=\"${x1}\" y1=\"${y1}\" x2=\"${x2}\" y2=\"${y2}\" stroke=\"${dimLineColor}\" stroke-width=\"${dimLineWeight}\" marker-end=\"url(#${markerId})\" />`,\n )\n\n // Add dimension text with diameter symbol\n const diameterText = entity.text ? `\u2300${entity.text}` : '\u2300'\n const angle = Math.atan2(y2 - y1, x2 - x1)\n const textRotation = (angle * 180) / Math.PI\n\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"${textHeight}\" fill=\"${textColor}\" text-anchor=\"middle\" transform=\"rotate(${-textRotation} ${textX} ${textY}) scale(1,-1) translate(0 ${-2 * textY})\">${diameterText}</text>`,\n )\n\n return {\n bbox,\n element: `<defs>${markers.join('')}</defs><g>${elements.join('')}</g>`,\n }\n}\n\n/**\n * Render radial dimension\n */\nfunction renderRadialDimension(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n const markers: string[] = []\n\n // Get dimension style properties\n const arrowSize = dimStyle?.dimAsz ?? 2.5\n const textHeight = dimStyle?.dimTxt ?? 2.5\n const { dimLineColor, textColor, dimLineWeight } = getDimensionColors(dimStyle)\n\n // Extract geometry\n const x1 = entity.measureStart?.x ?? 0\n const y1 = entity.measureStart?.y ?? 0\n const x2 = entity.measureEnd?.x ?? 0\n const y2 = entity.measureEnd?.y ?? 0\n const textX = entity.textMidpoint?.x ?? (x1 + x2) / 2\n const textY = entity.textMidpoint?.y ?? (y1 + y2) / 2\n\n bbox.expandByPoint({ x: x1, y: y1 })\n bbox.expandByPoint({ x: x2, y: y2 })\n bbox.expandByPoint({ x: textX, y: textY })\n\n // Create arrow markers\n const markerId = `dim-radius-arrow-${Date.now()}`\n markers.push(createArrowMarker(markerId, arrowSize, dimLineColor))\n\n // Create radius line with arrow at the end\n elements.push(\n `<line x1=\"${x1}\" y1=\"${y1}\" x2=\"${x2}\" y2=\"${y2}\" stroke=\"${dimLineColor}\" stroke-width=\"${dimLineWeight}\" marker-end=\"url(#${markerId})\" />`,\n )\n\n // Add dimension text with radius symbol\n const radiusText = entity.text ? `R${entity.text}` : 'R'\n const angle = Math.atan2(y2 - y1, x2 - x1)\n const textRotation = (angle * 180) / Math.PI\n\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"${textHeight}\" fill=\"${textColor}\" text-anchor=\"middle\" transform=\"rotate(${-textRotation} ${textX} ${textY}) scale(1,-1) translate(0 ${-2 * textY})\">${radiusText}</text>`,\n )\n\n return {\n bbox,\n element: `<defs>${markers.join('')}</defs><g>${elements.join('')}</g>`,\n }\n}\n\n/**\n * Render ordinate dimension\n */\nfunction renderOrdinateDimension(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n\n // Get dimension style properties\n const textHeight = dimStyle?.dimTxt ?? 2.5\n const { dimLineColor, textColor, dimLineWeight } = getDimensionColors(dimStyle)\n\n // Extract geometry\n const x1 = entity.measureStart?.x ?? 0\n const y1 = entity.measureStart?.y ?? 0\n const x2 = entity.start?.x ?? 0\n const y2 = entity.start?.y ?? 0\n const textX = entity.textMidpoint?.x ?? x2\n const textY = entity.textMidpoint?.y ?? y2\n\n bbox.expandByPoint({ x: x1, y: y1 })\n bbox.expandByPoint({ x: x2, y: y2 })\n bbox.expandByPoint({ x: textX, y: textY })\n\n // Create leader line (no arrow for ordinate dimensions)\n elements.push(\n `<line x1=\"${x1}\" y1=\"${y1}\" x2=\"${x2}\" y2=\"${y2}\" stroke=\"${dimLineColor}\" stroke-width=\"${dimLineWeight}\" />`,\n )\n\n // Add dimension text\n if (entity.text) {\n const angle = Math.atan2(y2 - y1, x2 - x1)\n const textRotation = (angle * 180) / Math.PI\n\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"${textHeight}\" fill=\"${textColor}\" text-anchor=\"middle\" transform=\"rotate(${-textRotation} ${textX} ${textY}) scale(1,-1) translate(0 ${-2 * textY})\">${entity.text}</text>`,\n )\n }\n\n return {\n bbox,\n element: `<g>${elements.join('')}</g>`,\n }\n}\n\n/**\n * Fallback renderer for unsupported dimension types\n */\nfunction renderFallbackDimension(entity: DimensionEntity): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n\n // Just render text at midpoint\n if (entity.textMidpoint) {\n const textX = entity.textMidpoint.x ?? 0\n const textY = entity.textMidpoint.y ?? 0\n bbox.expandByPoint({ x: textX, y: textY })\n\n if (entity.text) {\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"2.5\" text-anchor=\"middle\" transform=\"scale(1,-1) translate(0 ${-2 * textY})\">${entity.text}</text>`,\n )\n }\n }\n\n return {\n bbox,\n element: `<g>${elements.join('')}</g>`,\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,YAAY;AAErB,OAAO,YAAY;AASnB,SAAS,iBAAiB,aAA8B;AACtD,MAAI,gBAAgB,UAAa,cAAc,GAAG;AAChD,WAAO;AAAA,EACT;AAGA,MAAI,gBAAgB,KAAK,gBAAgB,KAAK;AAC5C,WAAO;AAAA,EACT;AAGA,QAAM,MAAM,OAAO,WAAW;AAC9B,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AAEA,SAAO,OAAO,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;AAC1C;AAKA,SAAS,mBAAmB,UAM1B;AACA,SAAO;AAAA,IACL,cAAc,iBAAiB,UAAU,OAAO;AAAA,IAChD,cAAc,iBAAiB,UAAU,OAAO;AAAA,IAChD,WAAW,iBAAiB,UAAU,OAAO;AAAA,IAC7C,eAAe,UAAU,UAAU;AAAA,IACnC,eAAe,UAAU,UAAU;AAAA,EACrC;AACF;AAKe,SAAR,eACL,QACA,UACkB;AAElB,UAAQ,OAAO,eAAe;AAAA,IAC5B,KAAK;AAAA;AAAA,IACL,KAAK;AACH,aAAO,sBAAsB,QAAQ,QAAQ;AAAA,IAC/C,KAAK;AACH,aAAO,uBAAuB,QAAQ,QAAQ;AAAA,IAChD,KAAK;AACH,aAAO,wBAAwB,QAAQ,QAAQ;AAAA,IACjD,KAAK;AACH,aAAO,sBAAsB,QAAQ,QAAQ;AAAA,IAC/C,KAAK;AACH,aAAO,wBAAwB,QAAQ,QAAQ;AAAA,IACjD;AAEE,aAAO,w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;AACvC,UAAM,QAAQ,OAAO,aAAa,KAAK;AACvC,SAAK,cAAc,EAAE,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzC,QAAI,OAAO,MAAM;AACf,eAAS;AAAA,QACP,YAAY,KAAK,QAAQ,KAAK,6EAA6E,KAAK,KAAK,MAAM,OAAO,IAAI;AAAA,MACxI;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA,SAAS,MAAM,SAAS,KAAK,EAAE,CAAC;AAAA,EAClC;AACF;",
4
+ "sourcesContent": ["import { Box2 } from 'vecks'\n\nimport colors from './util/colors'\nimport escapeXmlText from './util/escapeXmlText'\nimport round10 from './util/round10'\n\nimport type { DimensionEntity, ToSVGOptions } from './types'\nimport type { DimStyleTable } from './types/dxf'\nimport type { BoundsAndElement } from './types/svg'\n\nconst DEFAULT_DIMENSION_DECIMALS = 2\n\nexport interface DimensionViewport {\n width: number\n height: number\n}\n\n// AutoScale is meant to improve readability of dimension graphics.\n// Scale is derived from the drawing viewport (final SVG viewBox size).\n// No min/max clamp by design.\nconst AUTOSCALE_VIEWPORT_REFERENCE = 40\n\nconst computeViewportAutoScaleFactor = (\n viewport: DimensionViewport,\n options: ToSVGOptions | undefined,\n): number => {\n const viewportMin = Math.min(Math.abs(viewport.width), Math.abs(viewport.height))\n if (!Number.isFinite(viewportMin) || viewportMin <= 0) return 1\n\n const reference = options?.dimension?.autoScaleViewportReference\n const safeReference = Number.isFinite(reference) && (reference ?? 0) > 0\n ? (reference as number)\n : AUTOSCALE_VIEWPORT_REFERENCE\n\n return viewportMin / safeReference\n}\n\nconst getViewportMin = (viewport: DimensionViewport): number => {\n const viewportMin = Math.min(Math.abs(viewport.width), Math.abs(viewport.height))\n return Number.isFinite(viewportMin) ? viewportMin : Number.NaN\n}\n\nconst getViewportPercentageSize = (\n viewport: DimensionViewport,\n percent: number | undefined,\n): number | undefined => {\n if (!Number.isFinite(percent) || (percent ?? 0) <= 0) return undefined\n const viewportMin = getViewportMin(viewport)\n if (!Number.isFinite(viewportMin) || viewportMin <= 0) return undefined\n return viewportMin * ((percent as number) / 100)\n}\n\nexport const getDimensionGeometryBBox = (entity: DimensionEntity): Box2 => {\n const bbox = new Box2()\n\n const points = [\n entity.start,\n entity.angleVertex,\n entity.arcPoint,\n entity.textMidpoint,\n entity.measureStart,\n entity.measureEnd,\n ]\n\n for (const p of points) {\n if (!p) continue\n const x = p.x\n const y = p.y\n if (!Number.isFinite(x) || !Number.isFinite(y)) continue\n bbox.expandByPoint({ x, y })\n }\n\n return bbox\n}\n\nconst getScaledDimensionSizes = (\n dimStyle: DimStyleTable | undefined,\n options: ToSVGOptions | undefined,\n viewport: DimensionViewport | undefined,\n): {\n arrowSize: number\n textHeight: number\n extLineOffset: number\n extLineExtension: number\n} => {\n const autoScale = options?.dimension?.autoScale === true\n\n const baseArrowSize = dimStyle?.dimAsz ?? 2.5\n const baseTextHeight = dimStyle?.dimTxt ?? 2.5\n const baseExtLineOffset = dimStyle?.dimExo ?? 0.625\n const baseExtLineExtension = dimStyle?.dimExe ?? 1.25\n\n if (!autoScale || !viewport) {\n return {\n arrowSize: baseArrowSize,\n textHeight: baseTextHeight,\n extLineOffset: baseExtLineOffset,\n extLineExtension: baseExtLineExtension,\n }\n }\n\n const scale = computeViewportAutoScaleFactor(viewport, options)\n\n const perc = options?.dimension?.autoScaleViewportPercentages\n const arrowFromPct = getViewportPercentageSize(viewport, perc?.arrowSize)\n const textFromPct = getViewportPercentageSize(viewport, perc?.textHeight)\n const offsetFromPct = getViewportPercentageSize(viewport, perc?.extLineOffset)\n const extensionFromPct = getViewportPercentageSize(viewport, perc?.extLineExtension)\n\n return {\n arrowSize: arrowFromPct ?? (baseArrowSize * scale),\n textHeight: textFromPct ?? (baseTextHeight * scale),\n extLineOffset: offsetFromPct ?? (baseExtLineOffset * scale),\n extLineExtension: extensionFromPct ?? (baseExtLineExtension * scale),\n }\n}\n\nconst formatDimensionValue = (\n value: number,\n decimals: number = DEFAULT_DIMENSION_DECIMALS,\n): string => {\n if (!Number.isFinite(value)) return ''\n const rounded = round10(value, -decimals)\n return rounded.toFixed(decimals)\n}\n\nconst computeRadiusFallback = (entity: DimensionEntity): number => {\n const cx = entity.start?.x ?? 0\n const cy = entity.start?.y ?? 0\n const x1 = entity.measureStart?.x ?? 0\n const y1 = entity.measureStart?.y ?? 0\n const x2 = entity.measureEnd?.x ?? 0\n const y2 = entity.measureEnd?.y ?? 0\n\n const r1 = Math.hypot(x1 - cx, y1 - cy)\n const r2 = Math.hypot(x2 - cx, y2 - cy)\n const chord = Math.hypot(x2 - x1, y2 - y1)\n return Math.max(r1, r2, chord)\n}\n\nconst computeLinearDistance = (\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n): number => Math.hypot(x2 - x1, y2 - y1)\n\nconst computeAngularDegreesMinimal = (\n cx: number,\n cy: number,\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n): number => {\n const a1 = Math.atan2(y1 - cy, x1 - cx)\n const a2 = Math.atan2(y2 - cy, x2 - cx)\n let delta = Math.abs(a2 - a1)\n while (delta > Math.PI * 2) delta -= Math.PI * 2\n if (delta > Math.PI) delta = Math.PI * 2 - delta\n return (delta * 180) / Math.PI\n}\n\nconst computeAngularDegreesCCW = (\n cx: number,\n cy: number,\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n): number => {\n const a1 = Math.atan2(y1 - cy, x1 - cx)\n const a2 = Math.atan2(y2 - cy, x2 - cx)\n let delta = a2 - a1\n while (delta < 0) delta += Math.PI * 2\n while (delta >= Math.PI * 2) delta -= Math.PI * 2\n return (delta * 180) / Math.PI\n}\n\nconst computeDimensionMeasurement = (entity: DimensionEntity): string => {\n const x1 = entity.measureStart?.x ?? 0\n const y1 = entity.measureStart?.y ?? 0\n const x2 = entity.measureEnd?.x ?? 0\n const y2 = entity.measureEnd?.y ?? 0\n\n switch (entity.dimensionType) {\n case 0:\n case 1:\n case 6: {\n const dist = computeLinearDistance(x1, y1, x2, y2)\n return formatDimensionValue(dist)\n }\n case 3: {\n const dist = computeLinearDistance(x1, y1, x2, y2)\n if (dist > 0) return formatDimensionValue(dist)\n const radius = computeRadiusFallback(entity)\n return formatDimensionValue(radius * 2)\n }\n case 4: {\n const dist = computeLinearDistance(x1, y1, x2, y2)\n if (dist > 0) return formatDimensionValue(dist)\n const radius = computeRadiusFallback(entity)\n return formatDimensionValue(radius)\n }\n case 2: {\n const cx = entity.start?.x ?? 0\n const cy = entity.start?.y ?? 0\n const degrees = computeAngularDegreesMinimal(cx, cy, x1, y1, x2, y2)\n const formatted = formatDimensionValue(degrees)\n return formatted ? `${formatted}\u00B0` : ''\n }\n case 5: {\n const cx = entity.angleVertex?.x ?? 0\n const cy = entity.angleVertex?.y ?? 0\n const degrees = computeAngularDegreesCCW(cx, cy, x1, y1, x2, y2)\n const formatted = formatDimensionValue(degrees)\n return formatted ? `${formatted}\u00B0` : ''\n }\n default:\n return ''\n }\n}\n\nconst resolveDimensionText = (entity: DimensionEntity): string => {\n const raw = typeof entity.text === 'string' ? entity.text : ''\n const trimmed = raw.trim()\n const measured = computeDimensionMeasurement(entity)\n\n if (!trimmed) return measured\n if (trimmed.includes('<>')) {\n return trimmed.split('<>').join(measured)\n }\n return trimmed\n}\n\nconst expandBBoxForMarker = (bbox: Box2, x: number, y: number, size: number) => {\n bbox.expandByPoint({ x: x - size, y: y - size })\n bbox.expandByPoint({ x: x + size, y: y + size })\n}\n\nconst expandBBoxForText = (\n bbox: Box2,\n x: number,\n y: number,\n height: number,\n content: string,\n) => {\n const textWidth = content.length * height * 0.6\n // text-anchor=\"middle\" is used everywhere in DIMENSION rendering\n bbox.expandByPoint({ x: x - textWidth / 2, y: y - height })\n bbox.expandByPoint({ x: x + textWidth / 2, y: y + height })\n}\n\n/**\n * Convert DXF color number to SVG color string\n */\nfunction colorNumberToSVG(colorNumber?: number): string {\n if (colorNumber === undefined || colorNumber < 0) {\n return 'currentColor'\n }\n\n // DXF color 0 is ByBlock, 256 is ByLayer, 7 is white/black (depends on bg)\n if (colorNumber === 0 || colorNumber === 256) {\n return 'currentColor'\n }\n\n // Get RGB from color table\n const rgb = colors[colorNumber]\n if (!rgb) {\n return 'currentColor'\n }\n\n return `rgb(${rgb[0]},${rgb[1]},${rgb[2]})`\n}\n\n/**\n * Get dimension colors and weights from DIMSTYLE with defaults\n */\nfunction getDimensionColors(dimStyle?: DimStyleTable): {\n dimLineColor: string\n extLineColor: string\n textColor: string\n dimLineWeight: number\n extLineWeight: number\n} {\n return {\n dimLineColor: colorNumberToSVG(dimStyle?.dimClrd),\n extLineColor: colorNumberToSVG(dimStyle?.dimClre),\n textColor: colorNumberToSVG(dimStyle?.dimClrt),\n dimLineWeight: dimStyle?.dimLwd ?? 0.5,\n extLineWeight: dimStyle?.dimLwe ?? 0.5,\n }\n}\n\n/**\n * Render DIMENSION entity to SVG with proper DIMSTYLE support\n */\nexport default function dimensionToSVG(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n options?: ToSVGOptions,\n viewport?: DimensionViewport,\n): BoundsAndElement {\n // Dispatch to appropriate renderer based on dimension type\n switch (entity.dimensionType) {\n case 0: // Rotated, horizontal, or vertical\n case 1: // Aligned\n return renderLinearDimension(entity, dimStyle, options, viewport)\n case 2: // Angular\n return renderAngularDimension(entity, dimStyle, options, viewport)\n case 5: // Angular 3-point\n return renderAngular3PointDimension(entity, dimStyle, options, viewport)\n case 3: // Diameter\n return renderDiameterDimension(entity, dimStyle, options, viewport)\n case 4: // Radius\n return renderRadialDimension(entity, dimStyle, options, viewport)\n case 6: // Ordinate\n return renderOrdinateDimension(entity, dimStyle, options, viewport)\n default:\n // Fallback to simple line rendering\n return renderFallbackDimension(entity)\n }\n}\n\n/**\n * Render angular 3-point dimension (type 5).\n *\n * Based on DXF reference + ezdxf: angle is measured from p1 to p2\n * counter-clockwise around the vertex.\n */\nfunction renderAngular3PointDimension(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n options?: ToSVGOptions,\n viewport?: DimensionViewport,\n): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n const markers: string[] = []\n\n const { arrowSize, textHeight } = getScaledDimensionSizes(dimStyle, options, viewport)\n const { dimLineColor, extLineColor, textColor, dimLineWeight, extLineWeight } = getDimensionColors(dimStyle)\n\n const vertexX = entity.angleVertex?.x ?? 0\n const vertexY = entity.angleVertex?.y ?? 0\n const x1 = entity.measureStart?.x ?? 0\n const y1 = entity.measureStart?.y ?? 0\n const x2 = entity.measureEnd?.x ?? 0\n const y2 = entity.measureEnd?.y ?? 0\n\n // DXF reference: point (10,20,30) specifies the dimension line arc location.\n // In practice, ezdxf may also provide (16,26,36); prefer arcPoint only if it\n // yields a meaningful radius away from the vertex.\n const startArcX = entity.start?.x ?? 0\n const startArcY = entity.start?.y ?? 0\n const arcPointX = entity.arcPoint?.x\n const arcPointY = entity.arcPoint?.y\n\n const arcPointRadius =\n Number.isFinite(arcPointX) && Number.isFinite(arcPointY)\n ? Math.hypot((arcPointX as number) - vertexX, (arcPointY as number) - vertexY)\n : Number.NaN\n\n const useArcPoint = Number.isFinite(arcPointRadius) && arcPointRadius > 1e-9\n const arcLocationX = useArcPoint ? (arcPointX as number) : startArcX\n const arcLocationY = useArcPoint ? (arcPointY as number) : startArcY\n\n const textX = entity.textMidpoint?.x ?? arcLocationX\n const textY = entity.textMidpoint?.y ?? arcLocationY\n\n bbox.expandByPoint({ x: vertexX, y: vertexY })\n bbox.expandByPoint({ x: x1, y: y1 })\n bbox.expandByPoint({ x: x2, y: y2 })\n bbox.expandByPoint({ x: arcLocationX, y: arcLocationY })\n bbox.expandByPoint({ x: textX, y: textY })\n\n const a1 = Math.atan2(y1 - vertexY, x1 - vertexX)\n const a2 = Math.atan2(y2 - vertexY, x2 - vertexX)\n\n let radius = Math.hypot(arcLocationX - vertexX, arcLocationY - vertexY)\n if (!Number.isFinite(radius) || radius <= 1e-9) {\n radius = Math.hypot(textX - vertexX, textY - vertexY)\n }\n if (!Number.isFinite(radius) || radius <= 1e-9) {\n radius = Math.max(\n Math.hypot(x1 - vertexX, y1 - vertexY),\n Math.hypot(x2 - vertexX, y2 - vertexY),\n )\n }\n\n const arcStartX = vertexX + radius * Math.cos(a1)\n const arcStartY = vertexY + radius * Math.sin(a1)\n const arcEndX = vertexX + radius * Math.cos(a2)\n const arcEndY = vertexY + radius * Math.sin(a2)\n\n bbox.expandByPoint({ x: arcStartX, y: arcStartY })\n bbox.expandByPoint({ x: arcEndX, y: arcEndY })\n\n // Create arrow markers\n const markerId1 = `dim-angular-3p-arrow-start-${Date.now()}`\n const markerId2 = `dim-angular-3p-arrow-end-${Date.now()}`\n markers.push(\n createArrowMarker(markerId1, arrowSize, dimLineColor, 'backward'),\n createArrowMarker(markerId2, arrowSize, dimLineColor, 'forward'),\n )\n\n // Extension lines from definition points to arc endpoints.\n elements.push(\n `<line x1=\"${x1}\" y1=\"${y1}\" x2=\"${arcStartX}\" y2=\"${arcStartY}\" stroke=\"${extLineColor}\" stroke-width=\"${extLineWeight}\" />`,\n `<line x1=\"${x2}\" y1=\"${y2}\" x2=\"${arcEndX}\" y2=\"${arcEndY}\" stroke=\"${extLineColor}\" stroke-width=\"${extLineWeight}\" />`,\n )\n\n // Arc from a1 to a2 in CCW orientation.\n let delta = a2 - a1\n while (delta < 0) delta += Math.PI * 2\n while (delta >= Math.PI * 2) delta -= Math.PI * 2\n const largeArcFlag = delta > Math.PI ? 1 : 0\n const sweepFlag = 1\n\n expandBBoxForMarker(bbox, arcStartX, arcStartY, arrowSize)\n expandBBoxForMarker(bbox, arcEndX, arcEndY, arrowSize)\n\n elements.push(\n `<path d=\"M ${arcStartX} ${arcStartY} A ${radius} ${radius} 0 ${largeArcFlag} ${sweepFlag} ${arcEndX} ${arcEndY}\" fill=\"none\" stroke=\"${dimLineColor}\" stroke-width=\"${dimLineWeight}\" marker-start=\"url(#${markerId1})\" marker-end=\"url(#${markerId2})\" />`,\n )\n\n const resolvedText = resolveDimensionText(entity)\n if (resolvedText) {\n const midAngle = a1 + delta / 2\n const textRotation = (midAngle * 180) / Math.PI\n\n expandBBoxForText(bbox, textX, textY, textHeight, resolvedText)\n\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"${textHeight}\" fill=\"${textColor}\" text-anchor=\"middle\" transform=\"rotate(${-textRotation} ${textX} ${textY}) scale(1,-1) translate(0 ${-2 * textY})\">${escapeXmlText(resolvedText)}</text>`,\n )\n }\n\n return {\n bbox,\n element: `<defs>${markers.join('')}</defs><g>${elements.join('')}</g>`,\n }\n}\n\n/**\n * Create SVG marker definition for dimension arrows\n */\nexport function createArrowMarker(\n id: string,\n size: number,\n color: string,\n direction: 'forward' | 'backward' = 'forward',\n): string {\n const arrowPath = direction === 'forward'\n ? `M 0 0 L ${size} ${size / 2} L 0 ${size} z`\n : `M ${size} 0 L 0 ${size / 2} L ${size} ${size} z`\n const refX = direction === 'forward' ? size : 0\n\n return `<marker id=\"${id}\" markerWidth=\"${size}\" markerHeight=\"${size}\" refX=\"${refX}\" refY=\"${size / 2}\" orient=\"auto\" markerUnits=\"userSpaceOnUse\">\n <path d=\"${arrowPath}\" fill=\"${color}\" />\n </marker>`\n}\n\n/**\n * Render linear dimension (rotated, horizontal, vertical, or aligned)\n */\nfunction renderLinearDimension(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n options?: ToSVGOptions,\n viewport?: DimensionViewport,\n): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n const markers: string[] = []\n\n // Get dimension style properties with defaults (optionally auto-scaled)\n const { arrowSize, textHeight, extLineOffset, extLineExtension } =\n getScaledDimensionSizes(dimStyle, options, viewport)\n const { dimLineColor, extLineColor, textColor, dimLineWeight, extLineWeight } = getDimensionColors(dimStyle)\n\n // Extract dimension geometry\n const defPoint1X = entity.measureStart?.x ?? 0\n const defPoint1Y = entity.measureStart?.y ?? 0\n const defPoint2X = entity.measureEnd?.x ?? 0\n const defPoint2Y = entity.measureEnd?.y ?? 0\n const dimLineY = entity.start?.y ?? 0\n const textX = entity.textMidpoint?.x ?? (defPoint1X + defPoint2X) / 2\n const textY = entity.textMidpoint?.y ?? (defPoint1Y + defPoint2Y) / 2\n\n // Calculate dimension line angle\n const angle = Math.atan2(defPoint2Y - defPoint1Y, defPoint2X - defPoint1X)\n const perpAngle = angle + Math.PI / 2\n\n // Calculate dimension line endpoints\n const dimLine1X = defPoint1X + Math.cos(perpAngle) * (dimLineY - defPoint1Y)\n const dimLine1Y = defPoint1Y + Math.sin(perpAngle) * (dimLineY - defPoint1Y)\n const dimLine2X = defPoint2X + Math.cos(perpAngle) * (dimLineY - defPoint2Y)\n const dimLine2Y = defPoint2Y + Math.sin(perpAngle) * (dimLineY - defPoint2Y)\n\n // Expand bounding box\n bbox.expandByPoint({ x: defPoint1X, y: defPoint1Y })\n bbox.expandByPoint({ x: defPoint2X, y: defPoint2Y })\n bbox.expandByPoint({ x: dimLine1X, y: dimLine1Y })\n bbox.expandByPoint({ x: dimLine2X, y: dimLine2Y })\n bbox.expandByPoint({ x: textX, y: textY })\n\n // Create unique marker IDs for arrows\n const markerId1 = `dim-arrow-start-${Date.now()}`\n const markerId2 = `dim-arrow-end-${Date.now()}`\n\n // Create arrow markers with dimension line color\n markers.push(\n createArrowMarker(markerId1, arrowSize, dimLineColor, 'backward'),\n createArrowMarker(markerId2, arrowSize, dimLineColor, 'forward'),\n )\n\n // Draw extension lines\n const extLine1StartX = defPoint1X + Math.cos(perpAngle) * extLineOffset\n const extLine1StartY = defPoint1Y + Math.sin(perpAngle) * extLineOffset\n const extLine1EndX = dimLine1X + Math.cos(perpAngle) * extLineExtension\n const extLine1EndY = dimLine1Y + Math.sin(perpAngle) * extLineExtension\n\n const extLine2StartX = defPoint2X + Math.cos(perpAngle) * extLineOffset\n const extLine2StartY = defPoint2Y + Math.sin(perpAngle) * extLineOffset\n const extLine2EndX = dimLine2X + Math.cos(perpAngle) * extLineExtension\n const extLine2EndY = dimLine2Y + Math.sin(perpAngle) * extLineExtension\n\n // Expand bounding box to include full extension lines and arrow markers\n bbox.expandByPoint({ x: extLine1StartX, y: extLine1StartY })\n bbox.expandByPoint({ x: extLine1EndX, y: extLine1EndY })\n bbox.expandByPoint({ x: extLine2StartX, y: extLine2StartY })\n bbox.expandByPoint({ x: extLine2EndX, y: extLine2EndY })\n expandBBoxForMarker(bbox, dimLine1X, dimLine1Y, arrowSize)\n expandBBoxForMarker(bbox, dimLine2X, dimLine2Y, arrowSize)\n\n elements.push(\n `<line x1=\"${extLine1StartX}\" y1=\"${extLine1StartY}\" x2=\"${extLine1EndX}\" y2=\"${extLine1EndY}\" stroke=\"${extLineColor}\" stroke-width=\"${extLineWeight}\" />`,\n `<line x1=\"${extLine2StartX}\" y1=\"${extLine2StartY}\" x2=\"${extLine2EndX}\" y2=\"${extLine2EndY}\" stroke=\"${extLineColor}\" stroke-width=\"${extLineWeight}\" />`,\n `<line x1=\"${dimLine1X}\" y1=\"${dimLine1Y}\" x2=\"${dimLine2X}\" y2=\"${dimLine2Y}\" stroke=\"${dimLineColor}\" stroke-width=\"${dimLineWeight}\" marker-start=\"url(#${markerId1})\" marker-end=\"url(#${markerId2})\" />`,\n )\n\n // Add dimension text\n const resolvedText = resolveDimensionText(entity)\n if (resolvedText) {\n const textRotation = (angle * 180) / Math.PI\n expandBBoxForText(bbox, textX, textY, textHeight, resolvedText)\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"${textHeight}\" fill=\"${textColor}\" text-anchor=\"middle\" transform=\"rotate(${-textRotation} ${textX} ${textY}) scale(1,-1) translate(0 ${-2 * textY})\">${escapeXmlText(resolvedText)}</text>`,\n )\n }\n\n return {\n bbox,\n element: `<defs>${markers.join('')}</defs><g>${elements.join('')}</g>`,\n }\n}\n\n/**\n * Render angular dimension\n */\nfunction renderAngularDimension(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n options?: ToSVGOptions,\n viewport?: DimensionViewport,\n): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n const markers: string[] = []\n\n // Get dimension style properties (optionally auto-scaled)\n const { arrowSize, textHeight } = getScaledDimensionSizes(dimStyle, options, viewport)\n const { dimLineColor, extLineColor, textColor, dimLineWeight, extLineWeight } = getDimensionColors(dimStyle)\n\n // Extract points\n const centerX = entity.start?.x ?? 0\n const centerY = entity.start?.y ?? 0\n const x1 = entity.measureStart?.x ?? 0\n const y1 = entity.measureStart?.y ?? 0\n const x2 = entity.measureEnd?.x ?? 0\n const y2 = entity.measureEnd?.y ?? 0\n const textX = entity.textMidpoint?.x ?? centerX\n const textY = entity.textMidpoint?.y ?? centerY\n\n bbox.expandByPoint({ x: centerX, y: centerY })\n bbox.expandByPoint({ x: x1, y: y1 })\n bbox.expandByPoint({ x: x2, y: y2 })\n bbox.expandByPoint({ x: textX, y: textY })\n\n // Create arrow markers\n const markerId1 = `dim-angular-arrow-start-${Date.now()}`\n const markerId2 = `dim-angular-arrow-end-${Date.now()}`\n markers.push(\n createArrowMarker(markerId1, arrowSize, dimLineColor, 'backward'),\n createArrowMarker(markerId2, arrowSize, dimLineColor, 'forward'),\n )\n\n // Draw extension lines from center to definition points\n elements.push(\n `<line x1=\"${centerX}\" y1=\"${centerY}\" x2=\"${x1}\" y2=\"${y1}\" stroke=\"${extLineColor}\" stroke-width=\"${extLineWeight}\" />`,\n `<line x1=\"${centerX}\" y1=\"${centerY}\" x2=\"${x2}\" y2=\"${y2}\" stroke=\"${extLineColor}\" stroke-width=\"${extLineWeight}\" />`,\n )\n\n // Calculate arc radius (distance from center to text midpoint)\n const radius = Math.hypot(textX - centerX, textY - centerY)\n const startAngle = Math.atan2(y1 - centerY, x1 - centerX)\n const endAngle = Math.atan2(y2 - centerY, x2 - centerX)\n\n // Draw arc for angular dimension\n const largeArcFlag = Math.abs(endAngle - startAngle) > Math.PI ? 1 : 0\n const arcStartX = centerX + radius * Math.cos(startAngle)\n const arcStartY = centerY + radius * Math.sin(startAngle)\n const arcEndX = centerX + radius * Math.cos(endAngle)\n const arcEndY = centerY + radius * Math.sin(endAngle)\n\n elements.push(\n `<path d=\"M ${arcStartX} ${arcStartY} A ${radius} ${radius} 0 ${largeArcFlag} 1 ${arcEndX} ${arcEndY}\" fill=\"none\" stroke=\"${dimLineColor}\" stroke-width=\"${dimLineWeight}\" marker-start=\"url(#${markerId1})\" marker-end=\"url(#${markerId2})\" />`,\n )\n\n // Add dimension text\n const resolvedText = resolveDimensionText(entity)\n if (resolvedText) {\n const midAngle = (startAngle + endAngle) / 2\n const textRotation = (midAngle * 180) / Math.PI\n\n expandBBoxForText(bbox, textX, textY, textHeight, resolvedText)\n\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"${textHeight}\" fill=\"${textColor}\" text-anchor=\"middle\" transform=\"rotate(${-textRotation} ${textX} ${textY}) scale(1,-1) translate(0 ${-2 * textY})\">${escapeXmlText(resolvedText)}</text>`,\n )\n }\n\n return {\n bbox,\n element: `<defs>${markers.join('')}</defs><g>${elements.join('')}</g>`,\n }\n}\n\n/**\n * Render diameter dimension\n */\nfunction renderDiameterDimension(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n options?: ToSVGOptions,\n viewport?: DimensionViewport,\n): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n const markers: string[] = []\n\n // Get dimension style properties (optionally auto-scaled)\n const { arrowSize, textHeight } = getScaledDimensionSizes(dimStyle, options, viewport)\n const { dimLineColor, textColor, dimLineWeight } = getDimensionColors(dimStyle)\n\n // Extract geometry\n const x1 = entity.measureStart?.x ?? 0\n const y1 = entity.measureStart?.y ?? 0\n const x2 = entity.measureEnd?.x ?? 0\n const y2 = entity.measureEnd?.y ?? 0\n const textX = entity.textMidpoint?.x ?? (x1 + x2) / 2\n const textY = entity.textMidpoint?.y ?? (y1 + y2) / 2\n\n bbox.expandByPoint({ x: x1, y: y1 })\n bbox.expandByPoint({ x: x2, y: y2 })\n bbox.expandByPoint({ x: textX, y: textY })\n\n const diameterLen = Math.hypot(x2 - x1, y2 - y1)\n if (Number.isFinite(diameterLen) && diameterLen > 1e-6) {\n // Create arrow markers\n const markerId = `dim-diameter-arrow-${Date.now()}`\n markers.push(createArrowMarker(markerId, arrowSize, dimLineColor, 'backward'))\n\n // Create diameter line with arrow at the end\n elements.push(\n `<line x1=\"${x1}\" y1=\"${y1}\" x2=\"${x2}\" y2=\"${y2}\" stroke=\"${dimLineColor}\" stroke-width=\"${dimLineWeight}\" marker-end=\"url(#${markerId})\" />`,\n )\n\n expandBBoxForMarker(bbox, x2, y2, arrowSize)\n }\n\n // Add dimension text with diameter symbol\n const resolvedText = resolveDimensionText(entity)\n const diameterText = resolvedText ? `\u2300${resolvedText}` : '\u2300'\n const angle = Math.atan2(y2 - y1, x2 - x1)\n const textRotation = (angle * 180) / Math.PI\n\n expandBBoxForText(bbox, textX, textY, textHeight, diameterText)\n\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"${textHeight}\" fill=\"${textColor}\" text-anchor=\"middle\" transform=\"rotate(${-textRotation} ${textX} ${textY}) scale(1,-1) translate(0 ${-2 * textY})\">${escapeXmlText(diameterText)}</text>`,\n )\n\n return {\n bbox,\n element: `<defs>${markers.join('')}</defs><g>${elements.join('')}</g>`,\n }\n}\n\n/**\n * Render radial dimension\n */\nfunction renderRadialDimension(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n options?: ToSVGOptions,\n viewport?: DimensionViewport,\n): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n const markers: string[] = []\n\n // Get dimension style properties (optionally auto-scaled)\n const { arrowSize, textHeight } = getScaledDimensionSizes(dimStyle, options, viewport)\n const { dimLineColor, textColor, dimLineWeight } = getDimensionColors(dimStyle)\n\n // Extract geometry\n const x1 = entity.measureStart?.x ?? 0\n const y1 = entity.measureStart?.y ?? 0\n const x2 = entity.measureEnd?.x ?? 0\n const y2 = entity.measureEnd?.y ?? 0\n const textX = entity.textMidpoint?.x ?? (x1 + x2) / 2\n const textY = entity.textMidpoint?.y ?? (y1 + y2) / 2\n\n bbox.expandByPoint({ x: x1, y: y1 })\n bbox.expandByPoint({ x: x2, y: y2 })\n bbox.expandByPoint({ x: textX, y: textY })\n\n const radiusLen = Math.hypot(x2 - x1, y2 - y1)\n if (Number.isFinite(radiusLen) && radiusLen > 1e-6) {\n // Create arrow markers\n const markerId = `dim-radius-arrow-${Date.now()}`\n markers.push(createArrowMarker(markerId, arrowSize, dimLineColor, 'backward'))\n\n // Create radius line with arrow at the end\n elements.push(\n `<line x1=\"${x1}\" y1=\"${y1}\" x2=\"${x2}\" y2=\"${y2}\" stroke=\"${dimLineColor}\" stroke-width=\"${dimLineWeight}\" marker-end=\"url(#${markerId})\" />`,\n )\n\n expandBBoxForMarker(bbox, x2, y2, arrowSize)\n }\n\n // Add dimension text with radius symbol\n const resolvedText = resolveDimensionText(entity)\n const radiusText = resolvedText ? `R${resolvedText}` : 'R'\n const angle = Math.atan2(y2 - y1, x2 - x1)\n const textRotation = (angle * 180) / Math.PI\n\n expandBBoxForText(bbox, textX, textY, textHeight, radiusText)\n\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"${textHeight}\" fill=\"${textColor}\" text-anchor=\"middle\" transform=\"rotate(${-textRotation} ${textX} ${textY}) scale(1,-1) translate(0 ${-2 * textY})\">${escapeXmlText(radiusText)}</text>`,\n )\n\n return {\n bbox,\n element: `<defs>${markers.join('')}</defs><g>${elements.join('')}</g>`,\n }\n}\n\n/**\n * Render ordinate dimension\n */\nfunction renderOrdinateDimension(\n entity: DimensionEntity,\n dimStyle?: DimStyleTable,\n options?: ToSVGOptions,\n viewport?: DimensionViewport,\n): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n\n // Get dimension style properties (optionally auto-scaled)\n const { textHeight } = getScaledDimensionSizes(dimStyle, options, viewport)\n const { dimLineColor, textColor, dimLineWeight } = getDimensionColors(dimStyle)\n\n // Extract geometry\n const x1 = entity.measureStart?.x ?? 0\n const y1 = entity.measureStart?.y ?? 0\n const x2 = entity.start?.x ?? 0\n const y2 = entity.start?.y ?? 0\n const textX = entity.textMidpoint?.x ?? x2\n const textY = entity.textMidpoint?.y ?? y2\n\n bbox.expandByPoint({ x: x1, y: y1 })\n bbox.expandByPoint({ x: x2, y: y2 })\n bbox.expandByPoint({ x: textX, y: textY })\n\n // Create leader line (no arrow for ordinate dimensions)\n elements.push(\n `<line x1=\"${x1}\" y1=\"${y1}\" x2=\"${x2}\" y2=\"${y2}\" stroke=\"${dimLineColor}\" stroke-width=\"${dimLineWeight}\" />`,\n )\n\n // Add dimension text\n const resolvedText = resolveDimensionText(entity)\n if (resolvedText) {\n const angle = Math.atan2(y2 - y1, x2 - x1)\n const textRotation = (angle * 180) / Math.PI\n\n expandBBoxForText(bbox, textX, textY, textHeight, resolvedText)\n\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"${textHeight}\" fill=\"${textColor}\" text-anchor=\"middle\" transform=\"rotate(${-textRotation} ${textX} ${textY}) scale(1,-1) translate(0 ${-2 * textY})\">${escapeXmlText(resolvedText)}</text>`,\n )\n }\n\n return {\n bbox,\n element: `<g>${elements.join('')}</g>`,\n }\n}\n\n/**\n * Fallback renderer for unsupported dimension types\n */\nfunction renderFallbackDimension(entity: DimensionEntity): BoundsAndElement {\n const bbox = new Box2()\n const elements: string[] = []\n\n // Just render text at midpoint\n if (entity.textMidpoint) {\n const textX = entity.textMidpoint.x ?? 0\n const textY = entity.textMidpoint.y ?? 0\n bbox.expandByPoint({ x: textX, y: textY })\n\n const resolvedText = resolveDimensionText(entity)\n if (resolvedText) {\n elements.push(\n `<text x=\"${textX}\" y=\"${textY}\" font-size=\"2.5\" text-anchor=\"middle\" transform=\"scale(1,-1) translate(0 ${-2 * textY})\">${escapeXmlText(resolvedText)}</text>`,\n )\n }\n }\n\n return {\n bbox,\n element: `<g>${elements.join('')}</g>`,\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,YAAY;AAErB,OAAO,YAAY;AACnB,OAAO,mBAAmB;AAC1B,OAAO,aAAa;AAMpB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;AAAA,QACP,YAAY,KAAK,QAAQ,KAAK,6EAA6E,KAAK,KAAK,MAAM,cAAc,YAAY,CAAC;AAAA,MACxJ;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA,SAAS,MAAM,SAAS,KAAK,EAAE,CAAC;AAAA,EAClC;AACF;",
6
6
  "names": []
7
7
  }
@@ -36,10 +36,15 @@ var import_arc = __toESM(require("./entity/arc"), 1);
36
36
  var import_attdef = __toESM(require("./entity/attdef"), 1);
37
37
  var import_attrib = __toESM(require("./entity/attrib"), 1);
38
38
  var import_circle = __toESM(require("./entity/circle"), 1);
39
+ var import_dgnUnderlay = __toESM(require("./entity/dgnUnderlay"), 1);
39
40
  var import_dimension = __toESM(require("./entity/dimension"), 1);
41
+ var import_dwfUnderlay = __toESM(require("./entity/dwfUnderlay"), 1);
42
+ var import_pdfUnderlay = __toESM(require("./entity/pdfUnderlay"), 1);
40
43
  var import_ellipse = __toESM(require("./entity/ellipse"), 1);
41
44
  var import_hatch = __toESM(require("./entity/hatch"), 1);
45
+ var import_image = __toESM(require("./entity/image"), 1);
42
46
  var import_insert = __toESM(require("./entity/insert"), 1);
47
+ var import_leader = __toESM(require("./entity/leader"), 1);
43
48
  var import_line = __toESM(require("./entity/line"), 1);
44
49
  var import_lwpolyline = __toESM(require("./entity/lwpolyline"), 1);
45
50
  var import_mtext = __toESM(require("./entity/mtext"), 1);
@@ -50,6 +55,7 @@ var import_solid = __toESM(require("./entity/solid"), 1);
50
55
  var import_spline = __toESM(require("./entity/spline"), 1);
51
56
  var import_text = __toESM(require("./entity/text"), 1);
52
57
  var import_threeDFace = __toESM(require("./entity/threeDFace"), 1);
58
+ var import_tolerance = __toESM(require("./entity/tolerance"), 1);
53
59
  var import_vertex = __toESM(require("./entity/vertex"), 1);
54
60
  var import_viewport = __toESM(require("./entity/viewport"), 1);
55
61
  const handlers = [
@@ -64,7 +70,13 @@ const handlers = [
64
70
  import_spline.default,
65
71
  import_solid.default,
66
72
  import_hatch.default,
73
+ import_image.default,
74
+ import_leader.default,
75
+ import_dwfUnderlay.default,
76
+ import_dgnUnderlay.default,
77
+ import_pdfUnderlay.default,
67
78
  import_mtext.default,
79
+ import_tolerance.default,
68
80
  import_attdef.default,
69
81
  import_attrib.default,
70
82
  import_text.default,
@@ -77,8 +89,84 @@ const handlers = [
77
89
  acc[mod.TYPE] = mod;
78
90
  return acc;
79
91
  }, {});
92
+ class EntityGroupProcessor {
93
+ constructor() {
94
+ this.entities = [];
95
+ }
96
+ getEntities() {
97
+ return this.entities;
98
+ }
99
+ finalize() {
100
+ this.flushOpenPolyline("DXF ended with an open POLYLINE (missing SEQEND); flushing open polyline");
101
+ }
102
+ processGroup(tuples) {
103
+ const entityType = String(tuples[0][1]);
104
+ const contentTuples = tuples.slice(1);
105
+ switch (entityType) {
106
+ case "SEQEND":
107
+ this.endSequence();
108
+ break;
109
+ case "POLYLINE":
110
+ this.startPolyline(contentTuples);
111
+ break;
112
+ case "VERTEX":
113
+ this.addVertex(contentTuples);
114
+ break;
115
+ default:
116
+ this.addEntity(entityType, contentTuples);
117
+ break;
118
+ }
119
+ }
120
+ parseEntity(entityType, contentTuples) {
121
+ const handler = handlers[entityType];
122
+ if (!handler) {
123
+ import_logger.default.warn("unsupported type in ENTITIES section:", entityType);
124
+ return void 0;
125
+ }
126
+ return handler.process(contentTuples);
127
+ }
128
+ flushOpenPolyline(reason) {
129
+ if (!this.currentPolyline) return;
130
+ import_logger.default.warn(reason);
131
+ this.currentPolyline = void 0;
132
+ }
133
+ endSequence() {
134
+ this.currentPolyline = void 0;
135
+ }
136
+ startPolyline(contentTuples) {
137
+ this.flushOpenPolyline(
138
+ "POLYLINE started while previous POLYLINE is still open; flushing previous polyline"
139
+ );
140
+ const e = this.parseEntity("POLYLINE", contentTuples);
141
+ if (!e) return;
142
+ this.currentPolyline = e;
143
+ this.entities.push(e);
144
+ }
145
+ addVertex(contentTuples) {
146
+ const e = this.parseEntity("VERTEX", contentTuples);
147
+ if (!e) return;
148
+ if (!this.currentPolyline) {
149
+ import_logger.default.error("ignoring invalid VERTEX entity");
150
+ return;
151
+ }
152
+ this.currentPolyline.vertices.push(e);
153
+ }
154
+ addEntity(entityType, contentTuples) {
155
+ this.flushOpenPolyline("POLYLINE sequence ended without SEQEND; flushing open polyline");
156
+ const e = this.parseEntity(entityType, contentTuples);
157
+ if (!e) return;
158
+ this.entities.push(e);
159
+ }
160
+ }
161
+ function processEntityGroups(entityGroups) {
162
+ const processor = new EntityGroupProcessor();
163
+ for (const tuples of entityGroups) {
164
+ processor.processGroup(tuples);
165
+ }
166
+ processor.finalize();
167
+ return processor.getEntities();
168
+ }
80
169
  function parseEntities(tuples) {
81
- const entities = [];
82
170
  const entityGroups = [];
83
171
  let currentEntityTuples = [];
84
172
  for (const tuple of tuples) {
@@ -89,30 +177,6 @@ function parseEntities(tuples) {
89
177
  }
90
178
  currentEntityTuples.push(tuple);
91
179
  }
92
- let currentPolyline;
93
- for (const tuples2 of entityGroups) {
94
- const entityType = tuples2[0][1];
95
- const contentTuples = tuples2.slice(1);
96
- if (entityType in handlers) {
97
- const e = handlers[entityType].process(contentTuples);
98
- if (entityType === "POLYLINE") {
99
- currentPolyline = e;
100
- entities.push(e);
101
- } else if (entityType === "VERTEX") {
102
- if (currentPolyline) {
103
- currentPolyline.vertices.push(e);
104
- } else {
105
- import_logger.default.error("ignoring invalid VERTEX entity");
106
- }
107
- } else if (entityType === "SEQEND") {
108
- currentPolyline = void 0;
109
- } else {
110
- entities.push(e);
111
- }
112
- } else {
113
- import_logger.default.warn("unsupported type in ENTITIES section:", entityType);
114
- }
115
- }
116
- return entities;
180
+ return processEntityGroups(entityGroups);
117
181
  }
118
182
  //# sourceMappingURL=entities.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/handlers/entities.ts"],
4
- "sourcesContent": ["import type { DXFTuple } from '../types/dxf'\nimport type { Entity } from '../types/entity'\nimport type { PolylineEntity } from '../types/polyline-entity'\n\nimport logger from '../util/logger'\nimport arc from './entity/arc'\nimport attdef from './entity/attdef'\nimport attrib from './entity/attrib'\nimport circle from './entity/circle'\nimport dimension from './entity/dimension'\nimport ellipse from './entity/ellipse'\nimport hatch from './entity/hatch'\nimport insert from './entity/insert'\nimport line from './entity/line'\nimport lwpolyline from './entity/lwpolyline'\nimport mtext from './entity/mtext'\nimport ole2Frame from './entity/ole2Frame'\nimport point from './entity/point'\nimport polyline from './entity/polyline'\nimport solid from './entity/solid'\nimport spline from './entity/spline'\nimport text from './entity/text'\nimport threeDFace from './entity/threeDFace'\nimport vertex from './entity/vertex'\nimport viewport from './entity/viewport'\n\ninterface EntityHandler {\n TYPE: string\n process: (tuples: DXFTuple[]) => Entity\n}\n\nconst handlers: Record<string, EntityHandler> = [\n point,\n line,\n lwpolyline,\n polyline,\n vertex,\n circle,\n arc,\n ellipse,\n spline,\n solid,\n hatch,\n mtext,\n attdef,\n attrib,\n text,\n insert,\n dimension,\n threeDFace,\n viewport,\n ole2Frame,\n].reduce((acc, mod) => {\n acc[mod.TYPE] = mod\n return acc\n}, {} as Record<string, EntityHandler>)\n\n/**\n * Parses entities from DXF tuples\n *\n * @param tuples - Array of DXF tuples representing entities\n * @returns Array of parsed entities\n */\nexport default function parseEntities(tuples: DXFTuple[]): Entity[] {\n const entities: Entity[] = []\n const entityGroups: DXFTuple[][] = []\n let currentEntityTuples: DXFTuple[] = []\n\n // First group them together for easy processing\n for (const tuple of tuples) {\n const type = tuple[0]\n if (type === 0) {\n currentEntityTuples = []\n entityGroups.push(currentEntityTuples)\n }\n currentEntityTuples.push(tuple)\n }\n\n let currentPolyline: PolylineEntity | undefined\n for (const tuples of entityGroups) {\n const entityType = tuples[0][1]\n const contentTuples = tuples.slice(1)\n\n if (entityType in handlers) {\n const e = handlers[entityType].process(contentTuples)\n // \"POLYLINE\" cannot be parsed in isolation, it is followed by\n // N \"VERTEX\" entities and ended with a \"SEQEND\" entity.\n // Essentially we convert POLYLINE to LWPOLYLINE - the extra\n // vertex flags are not supported\n if (entityType === 'POLYLINE') {\n currentPolyline = e as PolylineEntity\n entities.push(e)\n } else if (entityType === 'VERTEX') {\n if (currentPolyline) {\n currentPolyline.vertices.push(e as any)\n } else {\n logger.error('ignoring invalid VERTEX entity')\n }\n } else if (entityType === 'SEQEND') {\n currentPolyline = undefined\n } else {\n // All other entities\n entities.push(e)\n }\n } else {\n logger.warn('unsupported type in ENTITIES section:', entityType)\n }\n }\n\n return entities\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,oBAAmB;AACnB,iBAAgB;AAChB,oBAAmB;AACnB,oBAAmB;AACnB,oBAAmB;AACnB,uBAAsB;AACtB,qBAAoB;AACpB,mBAAkB;AAClB,oBAAmB;AACnB,kBAAiB;AACjB,wBAAuB;AACvB,mBAAkB;AAClB,uBAAsB;AACtB,mBAAkB;AAClB,sBAAqB;AACrB,mBAAkB;AAClB,oBAAmB;AACnB,kBAAiB;AACjB,wBAAuB;AACvB,oBAAmB;AACnB,sBAAqB;AAOrB,MAAM,WAA0C;AAAA,EAC9C,aAAAA;AAAA,EACA,YAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,iBAAAC;AACF,EAAE,OAAO,CAAC,KAAK,QAAQ;AACrB,MAAI,IAAI,IAAI,IAAI;AAChB,SAAO;AACT,GAAG,CAAC,CAAkC;AAQvB,SAAR,cAA+B,QAA8B;AAClE,QAAM,WAAqB,CAAC;AAC5B,QAAM,eAA6B,CAAC;AACpC,MAAI,sBAAkC,CAAC;AAGvC,aAAW,SAAS,QAAQ;AAC1B,UAAM,OAAO,MAAM,CAAC;AACpB,QAAI,SAAS,GAAG;AACd,4BAAsB,CAAC;AACvB,mBAAa,KAAK,mBAAmB;AAAA,IACvC;AACA,wBAAoB,KAAK,KAAK;AAAA,EAChC;AAEA,MAAI;AACJ,aAAWC,WAAU,cAAc;AACjC,UAAM,aAAaA,QAAO,CAAC,EAAE,CAAC;AAC9B,UAAM,gBAAgBA,QAAO,MAAM,CAAC;AAEpC,QAAI,cAAc,UAAU;AAC1B,YAAM,IAAI,SAAS,UAAU,EAAE,QAAQ,aAAa;AAKpD,UAAI,eAAe,YAAY;AAC7B,0BAAkB;AAClB,iBAAS,KAAK,CAAC;AAAA,MACjB,WAAW,eAAe,UAAU;AAClC,YAAI,iBAAiB;AACnB,0BAAgB,SAAS,KAAK,CAAQ;AAAA,QACxC,OAAO;AACL,wBAAAC,QAAO,MAAM,gCAAgC;AAAA,QAC/C;AAAA,MACF,WAAW,eAAe,UAAU;AAClC,0BAAkB;AAAA,MACpB,OAAO;AAEL,iBAAS,KAAK,CAAC;AAAA,MACjB;AAAA,IACF,OAAO;AACL,oBAAAA,QAAO,KAAK,yCAAyC,UAAU;AAAA,IACjE;AAAA,EACF;AAEA,SAAO;AACT;",
6
- "names": ["point", "line", "lwpolyline", "polyline", "vertex", "circle", "arc", "ellipse", "spline", "solid", "hatch", "mtext", "attdef", "attrib", "text", "insert", "dimension", "threeDFace", "viewport", "ole2Frame", "tuples", "logger"]
4
+ "sourcesContent": ["import type { DXFTuple } from '../types/dxf'\nimport type { Entity } from '../types/entity'\nimport type { PolylineEntity, Vertex } from '../types/polyline-entity'\n\nimport logger from '../util/logger'\nimport arc from './entity/arc'\nimport attdef from './entity/attdef'\nimport attrib from './entity/attrib'\nimport circle from './entity/circle'\nimport dgnUnderlay from './entity/dgnUnderlay'\nimport dimension from './entity/dimension'\nimport dwfUnderlay from './entity/dwfUnderlay'\nimport pdfUnderlay from './entity/pdfUnderlay'\nimport ellipse from './entity/ellipse'\nimport hatch from './entity/hatch'\nimport image from './entity/image'\nimport insert from './entity/insert'\nimport leader from './entity/leader'\nimport line from './entity/line'\nimport lwpolyline from './entity/lwpolyline'\nimport mtext from './entity/mtext'\nimport ole2Frame from './entity/ole2Frame'\nimport point from './entity/point'\nimport polyline from './entity/polyline'\nimport solid from './entity/solid'\nimport spline from './entity/spline'\nimport text from './entity/text'\nimport threeDFace from './entity/threeDFace'\nimport tolerance from './entity/tolerance'\nimport vertex from './entity/vertex'\nimport viewport from './entity/viewport'\n\ninterface EntityHandler {\n TYPE: string\n process: (tuples: DXFTuple[]) => Entity\n}\n\nconst handlers: Record<string, EntityHandler> = [\n point,\n line,\n lwpolyline,\n polyline,\n vertex,\n circle,\n arc,\n ellipse,\n spline,\n solid,\n hatch,\n image,\n leader,\n dwfUnderlay,\n dgnUnderlay,\n pdfUnderlay,\n mtext,\n tolerance,\n attdef,\n attrib,\n text,\n insert,\n dimension,\n threeDFace,\n viewport,\n ole2Frame,\n].reduce((acc, mod) => {\n acc[mod.TYPE] = mod\n return acc\n}, {} as Record<string, EntityHandler>)\n\n/**\n * Parses entities from DXF tuples\n *\n * @param tuples - Array of DXF tuples representing entities\n * @returns Array of parsed entities\n */\nclass EntityGroupProcessor {\n private readonly entities: Entity[] = []\n private currentPolyline: PolylineEntity | undefined\n\n getEntities(): Entity[] {\n return this.entities\n }\n\n finalize(): void {\n this.flushOpenPolyline('DXF ended with an open POLYLINE (missing SEQEND); flushing open polyline')\n }\n\n processGroup(tuples: DXFTuple[]): void {\n const entityType = String(tuples[0][1])\n const contentTuples = tuples.slice(1)\n\n switch (entityType) {\n case 'SEQEND':\n this.endSequence()\n break\n case 'POLYLINE':\n this.startPolyline(contentTuples)\n break\n case 'VERTEX':\n this.addVertex(contentTuples)\n break\n default:\n this.addEntity(entityType, contentTuples)\n break\n }\n }\n\n private parseEntity(entityType: string, contentTuples: DXFTuple[]): Entity | undefined {\n const handler = handlers[entityType]\n if (!handler) {\n logger.warn('unsupported type in ENTITIES section:', entityType)\n return undefined\n }\n return handler.process(contentTuples)\n }\n\n private flushOpenPolyline(reason: string): void {\n if (!this.currentPolyline) return\n logger.warn(reason)\n this.currentPolyline = undefined\n }\n\n private endSequence(): void {\n // SEQEND may also terminate other sequences (e.g. INSERT attributes).\n // Only treat it as significant when we're inside a POLYLINE sequence.\n this.currentPolyline = undefined\n }\n\n private startPolyline(contentTuples: DXFTuple[]): void {\n this.flushOpenPolyline(\n 'POLYLINE started while previous POLYLINE is still open; flushing previous polyline',\n )\n\n const e = this.parseEntity('POLYLINE', contentTuples)\n if (!e) return\n\n this.currentPolyline = e as PolylineEntity\n this.entities.push(e)\n }\n\n private addVertex(contentTuples: DXFTuple[]): void {\n const e = this.parseEntity('VERTEX', contentTuples)\n if (!e) return\n\n if (!this.currentPolyline) {\n logger.error('ignoring invalid VERTEX entity')\n return\n }\n\n this.currentPolyline.vertices.push(e as Vertex)\n }\n\n private addEntity(entityType: string, contentTuples: DXFTuple[]): void {\n this.flushOpenPolyline('POLYLINE sequence ended without SEQEND; flushing open polyline')\n\n const e = this.parseEntity(entityType, contentTuples)\n if (!e) return\n this.entities.push(e)\n }\n}\n\nfunction processEntityGroups(entityGroups: DXFTuple[][]): Entity[] {\n const processor = new EntityGroupProcessor()\n for (const tuples of entityGroups) {\n processor.processGroup(tuples)\n }\n processor.finalize()\n return processor.getEntities()\n}\n\nexport default function parseEntities(tuples: DXFTuple[]): Entity[] {\n const entityGroups: DXFTuple[][] = []\n let currentEntityTuples: DXFTuple[] = []\n\n // First group them together for easy processing\n for (const tuple of tuples) {\n const type = tuple[0]\n if (type === 0) {\n currentEntityTuples = []\n entityGroups.push(currentEntityTuples)\n }\n currentEntityTuples.push(tuple)\n }\n\n return processEntityGroups(entityGroups)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;A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AAK,SAAS,KAAK,CAAC;AAAA,EACtB;AACF;AAEA,SAAS,oBAAoB,cAAsC;AACjE,QAAM,YAAY,IAAI,qBAAqB;AAC3C,aAAW,UAAU,cAAc;AACjC,cAAU,aAAa,MAAM;AAAA,EAC/B;AACA,YAAU,SAAS;AACnB,SAAO,UAAU,YAAY;AAC/B;AAEe,SAAR,cAA+B,QAA8B;AAClE,QAAM,eAA6B,CAAC;AACpC,MAAI,sBAAkC,CAAC;AAGvC,aAAW,SAAS,QAAQ;AAC1B,UAAM,OAAO,MAAM,CAAC;AACpB,QAAI,SAAS,GAAG;AACd,4BAAsB,CAAC;AACvB,mBAAa,KAAK,mBAAmB;AAAA,IACvC;AACA,wBAAoB,KAAK,KAAK;AAAA,EAChC;AAEA,SAAO,oBAAoB,YAAY;AACzC;",
6
+ "names": ["point", "line", "lwpolyline", "polyline", "vertex", "circle", "arc", "ellipse", "spline", "solid", "hatch", "image", "leader", "dwfUnderlay", "dgnUnderlay", "pdfUnderlay", "mtext", "tolerance", "attdef", "attrib", "text", "insert", "dimension", "threeDFace", "viewport", "ole2Frame", "logger"]
7
7
  }
@@ -3,10 +3,15 @@ import arc from "./entity/arc";
3
3
  import attdef from "./entity/attdef";
4
4
  import attrib from "./entity/attrib";
5
5
  import circle from "./entity/circle";
6
+ import dgnUnderlay from "./entity/dgnUnderlay";
6
7
  import dimension from "./entity/dimension";
8
+ import dwfUnderlay from "./entity/dwfUnderlay";
9
+ import pdfUnderlay from "./entity/pdfUnderlay";
7
10
  import ellipse from "./entity/ellipse";
8
11
  import hatch from "./entity/hatch";
12
+ import image from "./entity/image";
9
13
  import insert from "./entity/insert";
14
+ import leader from "./entity/leader";
10
15
  import line from "./entity/line";
11
16
  import lwpolyline from "./entity/lwpolyline";
12
17
  import mtext from "./entity/mtext";
@@ -17,6 +22,7 @@ import solid from "./entity/solid";
17
22
  import spline from "./entity/spline";
18
23
  import text from "./entity/text";
19
24
  import threeDFace from "./entity/threeDFace";
25
+ import tolerance from "./entity/tolerance";
20
26
  import vertex from "./entity/vertex";
21
27
  import viewport from "./entity/viewport";
22
28
  const handlers = [
@@ -31,7 +37,13 @@ const handlers = [
31
37
  spline,
32
38
  solid,
33
39
  hatch,
40
+ image,
41
+ leader,
42
+ dwfUnderlay,
43
+ dgnUnderlay,
44
+ pdfUnderlay,
34
45
  mtext,
46
+ tolerance,
35
47
  attdef,
36
48
  attrib,
37
49
  text,
@@ -44,8 +56,84 @@ const handlers = [
44
56
  acc[mod.TYPE] = mod;
45
57
  return acc;
46
58
  }, {});
59
+ class EntityGroupProcessor {
60
+ constructor() {
61
+ this.entities = [];
62
+ }
63
+ getEntities() {
64
+ return this.entities;
65
+ }
66
+ finalize() {
67
+ this.flushOpenPolyline("DXF ended with an open POLYLINE (missing SEQEND); flushing open polyline");
68
+ }
69
+ processGroup(tuples) {
70
+ const entityType = String(tuples[0][1]);
71
+ const contentTuples = tuples.slice(1);
72
+ switch (entityType) {
73
+ case "SEQEND":
74
+ this.endSequence();
75
+ break;
76
+ case "POLYLINE":
77
+ this.startPolyline(contentTuples);
78
+ break;
79
+ case "VERTEX":
80
+ this.addVertex(contentTuples);
81
+ break;
82
+ default:
83
+ this.addEntity(entityType, contentTuples);
84
+ break;
85
+ }
86
+ }
87
+ parseEntity(entityType, contentTuples) {
88
+ const handler = handlers[entityType];
89
+ if (!handler) {
90
+ logger.warn("unsupported type in ENTITIES section:", entityType);
91
+ return void 0;
92
+ }
93
+ return handler.process(contentTuples);
94
+ }
95
+ flushOpenPolyline(reason) {
96
+ if (!this.currentPolyline) return;
97
+ logger.warn(reason);
98
+ this.currentPolyline = void 0;
99
+ }
100
+ endSequence() {
101
+ this.currentPolyline = void 0;
102
+ }
103
+ startPolyline(contentTuples) {
104
+ this.flushOpenPolyline(
105
+ "POLYLINE started while previous POLYLINE is still open; flushing previous polyline"
106
+ );
107
+ const e = this.parseEntity("POLYLINE", contentTuples);
108
+ if (!e) return;
109
+ this.currentPolyline = e;
110
+ this.entities.push(e);
111
+ }
112
+ addVertex(contentTuples) {
113
+ const e = this.parseEntity("VERTEX", contentTuples);
114
+ if (!e) return;
115
+ if (!this.currentPolyline) {
116
+ logger.error("ignoring invalid VERTEX entity");
117
+ return;
118
+ }
119
+ this.currentPolyline.vertices.push(e);
120
+ }
121
+ addEntity(entityType, contentTuples) {
122
+ this.flushOpenPolyline("POLYLINE sequence ended without SEQEND; flushing open polyline");
123
+ const e = this.parseEntity(entityType, contentTuples);
124
+ if (!e) return;
125
+ this.entities.push(e);
126
+ }
127
+ }
128
+ function processEntityGroups(entityGroups) {
129
+ const processor = new EntityGroupProcessor();
130
+ for (const tuples of entityGroups) {
131
+ processor.processGroup(tuples);
132
+ }
133
+ processor.finalize();
134
+ return processor.getEntities();
135
+ }
47
136
  function parseEntities(tuples) {
48
- const entities = [];
49
137
  const entityGroups = [];
50
138
  let currentEntityTuples = [];
51
139
  for (const tuple of tuples) {
@@ -56,31 +144,7 @@ function parseEntities(tuples) {
56
144
  }
57
145
  currentEntityTuples.push(tuple);
58
146
  }
59
- let currentPolyline;
60
- for (const tuples2 of entityGroups) {
61
- const entityType = tuples2[0][1];
62
- const contentTuples = tuples2.slice(1);
63
- if (entityType in handlers) {
64
- const e = handlers[entityType].process(contentTuples);
65
- if (entityType === "POLYLINE") {
66
- currentPolyline = e;
67
- entities.push(e);
68
- } else if (entityType === "VERTEX") {
69
- if (currentPolyline) {
70
- currentPolyline.vertices.push(e);
71
- } else {
72
- logger.error("ignoring invalid VERTEX entity");
73
- }
74
- } else if (entityType === "SEQEND") {
75
- currentPolyline = void 0;
76
- } else {
77
- entities.push(e);
78
- }
79
- } else {
80
- logger.warn("unsupported type in ENTITIES section:", entityType);
81
- }
82
- }
83
- return entities;
147
+ return processEntityGroups(entityGroups);
84
148
  }
85
149
  export {
86
150
  parseEntities as default
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/handlers/entities.ts"],
4
- "sourcesContent": ["import type { DXFTuple } from '../types/dxf'\nimport type { Entity } from '../types/entity'\nimport type { PolylineEntity } from '../types/polyline-entity'\n\nimport logger from '../util/logger'\nimport arc from './entity/arc'\nimport attdef from './entity/attdef'\nimport attrib from './entity/attrib'\nimport circle from './entity/circle'\nimport dimension from './entity/dimension'\nimport ellipse from './entity/ellipse'\nimport hatch from './entity/hatch'\nimport insert from './entity/insert'\nimport line from './entity/line'\nimport lwpolyline from './entity/lwpolyline'\nimport mtext from './entity/mtext'\nimport ole2Frame from './entity/ole2Frame'\nimport point from './entity/point'\nimport polyline from './entity/polyline'\nimport solid from './entity/solid'\nimport spline from './entity/spline'\nimport text from './entity/text'\nimport threeDFace from './entity/threeDFace'\nimport vertex from './entity/vertex'\nimport viewport from './entity/viewport'\n\ninterface EntityHandler {\n TYPE: string\n process: (tuples: DXFTuple[]) => Entity\n}\n\nconst handlers: Record<string, EntityHandler> = [\n point,\n line,\n lwpolyline,\n polyline,\n vertex,\n circle,\n arc,\n ellipse,\n spline,\n solid,\n hatch,\n mtext,\n attdef,\n attrib,\n text,\n insert,\n dimension,\n threeDFace,\n viewport,\n ole2Frame,\n].reduce((acc, mod) => {\n acc[mod.TYPE] = mod\n return acc\n}, {} as Record<string, EntityHandler>)\n\n/**\n * Parses entities from DXF tuples\n *\n * @param tuples - Array of DXF tuples representing entities\n * @returns Array of parsed entities\n */\nexport default function parseEntities(tuples: DXFTuple[]): Entity[] {\n const entities: Entity[] = []\n const entityGroups: DXFTuple[][] = []\n let currentEntityTuples: DXFTuple[] = []\n\n // First group them together for easy processing\n for (const tuple of tuples) {\n const type = tuple[0]\n if (type === 0) {\n currentEntityTuples = []\n entityGroups.push(currentEntityTuples)\n }\n currentEntityTuples.push(tuple)\n }\n\n let currentPolyline: PolylineEntity | undefined\n for (const tuples of entityGroups) {\n const entityType = tuples[0][1]\n const contentTuples = tuples.slice(1)\n\n if (entityType in handlers) {\n const e = handlers[entityType].process(contentTuples)\n // \"POLYLINE\" cannot be parsed in isolation, it is followed by\n // N \"VERTEX\" entities and ended with a \"SEQEND\" entity.\n // Essentially we convert POLYLINE to LWPOLYLINE - the extra\n // vertex flags are not supported\n if (entityType === 'POLYLINE') {\n currentPolyline = e as PolylineEntity\n entities.push(e)\n } else if (entityType === 'VERTEX') {\n if (currentPolyline) {\n currentPolyline.vertices.push(e as any)\n } else {\n logger.error('ignoring invalid VERTEX entity')\n }\n } else if (entityType === 'SEQEND') {\n currentPolyline = undefined\n } else {\n // All other entities\n entities.push(e)\n }\n } else {\n logger.warn('unsupported type in ENTITIES section:', entityType)\n }\n }\n\n return entities\n}\n"],
5
- "mappings": "AAIA,OAAO,YAAY;AACnB,OAAO,SAAS;AAChB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,eAAe;AACtB,OAAO,aAAa;AACpB,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,OAAO,cAAc;AACrB,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,YAAY;AACnB,OAAO,cAAc;AAOrB,MAAM,WAA0C;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,OAAO,CAAC,KAAK,QAAQ;AACrB,MAAI,IAAI,IAAI,IAAI;AAChB,SAAO;AACT,GAAG,CAAC,CAAkC;AAQvB,SAAR,cAA+B,QAA8B;AAClE,QAAM,WAAqB,CAAC;AAC5B,QAAM,eAA6B,CAAC;AACpC,MAAI,sBAAkC,CAAC;AAGvC,aAAW,SAAS,QAAQ;AAC1B,UAAM,OAAO,MAAM,CAAC;AACpB,QAAI,SAAS,GAAG;AACd,4BAAsB,CAAC;AACvB,mBAAa,KAAK,mBAAmB;AAAA,IACvC;AACA,wBAAoB,KAAK,KAAK;AAAA,EAChC;AAEA,MAAI;AACJ,aAAWA,WAAU,cAAc;AACjC,UAAM,aAAaA,QAAO,CAAC,EAAE,CAAC;AAC9B,UAAM,gBAAgBA,QAAO,MAAM,CAAC;AAEpC,QAAI,cAAc,UAAU;AAC1B,YAAM,IAAI,SAAS,UAAU,EAAE,QAAQ,aAAa;AAKpD,UAAI,eAAe,YAAY;AAC7B,0BAAkB;AAClB,iBAAS,KAAK,CAAC;AAAA,MACjB,WAAW,eAAe,UAAU;AAClC,YAAI,iBAAiB;AACnB,0BAAgB,SAAS,KAAK,CAAQ;AAAA,QACxC,OAAO;AACL,iBAAO,MAAM,gCAAgC;AAAA,QAC/C;AAAA,MACF,WAAW,eAAe,UAAU;AAClC,0BAAkB;AAAA,MACpB,OAAO;AAEL,iBAAS,KAAK,CAAC;AAAA,MACjB;AAAA,IACF,OAAO;AACL,aAAO,KAAK,yCAAyC,UAAU;AAAA,IACjE;AAAA,EACF;AAEA,SAAO;AACT;",
6
- "names": ["tuples"]
4
+ "sourcesContent": ["import type { DXFTuple } from '../types/dxf'\nimport type { Entity } from '../types/entity'\nimport type { PolylineEntity, Vertex } from '../types/polyline-entity'\n\nimport logger from '../util/logger'\nimport arc from './entity/arc'\nimport attdef from './entity/attdef'\nimport attrib from './entity/attrib'\nimport circle from './entity/circle'\nimport dgnUnderlay from './entity/dgnUnderlay'\nimport dimension from './entity/dimension'\nimport dwfUnderlay from './entity/dwfUnderlay'\nimport pdfUnderlay from './entity/pdfUnderlay'\nimport ellipse from './entity/ellipse'\nimport hatch from './entity/hatch'\nimport image from './entity/image'\nimport insert from './entity/insert'\nimport leader from './entity/leader'\nimport line from './entity/line'\nimport lwpolyline from './entity/lwpolyline'\nimport mtext from './entity/mtext'\nimport ole2Frame from './entity/ole2Frame'\nimport point from './entity/point'\nimport polyline from './entity/polyline'\nimport solid from './entity/solid'\nimport spline from './entity/spline'\nimport text from './entity/text'\nimport threeDFace from './entity/threeDFace'\nimport tolerance from './entity/tolerance'\nimport vertex from './entity/vertex'\nimport viewport from './entity/viewport'\n\ninterface EntityHandler {\n TYPE: string\n process: (tuples: DXFTuple[]) => Entity\n}\n\nconst handlers: Record<string, EntityHandler> = [\n point,\n line,\n lwpolyline,\n polyline,\n vertex,\n circle,\n arc,\n ellipse,\n spline,\n solid,\n hatch,\n image,\n leader,\n dwfUnderlay,\n dgnUnderlay,\n pdfUnderlay,\n mtext,\n tolerance,\n attdef,\n attrib,\n text,\n insert,\n dimension,\n threeDFace,\n viewport,\n ole2Frame,\n].reduce((acc, mod) => {\n acc[mod.TYPE] = mod\n return acc\n}, {} as Record<string, EntityHandler>)\n\n/**\n * Parses entities from DXF tuples\n *\n * @param tuples - Array of DXF tuples representing entities\n * @returns Array of parsed entities\n */\nclass EntityGroupProcessor {\n private readonly entities: Entity[] = []\n private currentPolyline: PolylineEntity | undefined\n\n getEntities(): Entity[] {\n return this.entities\n }\n\n finalize(): void {\n this.flushOpenPolyline('DXF ended with an open POLYLINE (missing SEQEND); flushing open polyline')\n }\n\n processGroup(tuples: DXFTuple[]): void {\n const entityType = String(tuples[0][1])\n const contentTuples = tuples.slice(1)\n\n switch (entityType) {\n case 'SEQEND':\n this.endSequence()\n break\n case 'POLYLINE':\n this.startPolyline(contentTuples)\n break\n case 'VERTEX':\n this.addVertex(contentTuples)\n break\n default:\n this.addEntity(entityType, contentTuples)\n break\n }\n }\n\n private parseEntity(entityType: string, contentTuples: DXFTuple[]): Entity | undefined {\n const handler = handlers[entityType]\n if (!handler) {\n logger.warn('unsupported type in ENTITIES section:', entityType)\n return undefined\n }\n return handler.process(contentTuples)\n }\n\n private flushOpenPolyline(reason: string): void {\n if (!this.currentPolyline) return\n logger.warn(reason)\n this.currentPolyline = undefined\n }\n\n private endSequence(): void {\n // SEQEND may also terminate other sequences (e.g. INSERT attributes).\n // Only treat it as significant when we're inside a POLYLINE sequence.\n this.currentPolyline = undefined\n }\n\n private startPolyline(contentTuples: DXFTuple[]): void {\n this.flushOpenPolyline(\n 'POLYLINE started while previous POLYLINE is still open; flushing previous polyline',\n )\n\n const e = this.parseEntity('POLYLINE', contentTuples)\n if (!e) return\n\n this.currentPolyline = e as PolylineEntity\n this.entities.push(e)\n }\n\n private addVertex(contentTuples: DXFTuple[]): void {\n const e = this.parseEntity('VERTEX', contentTuples)\n if (!e) return\n\n if (!this.currentPolyline) {\n logger.error('ignoring invalid VERTEX entity')\n return\n }\n\n this.currentPolyline.vertices.push(e as Vertex)\n }\n\n private addEntity(entityType: string, contentTuples: DXFTuple[]): void {\n this.flushOpenPolyline('POLYLINE sequence ended without SEQEND; flushing open polyline')\n\n const e = this.parseEntity(entityType, contentTuples)\n if (!e) return\n this.entities.push(e)\n }\n}\n\nfunction processEntityGroups(entityGroups: DXFTuple[][]): Entity[] {\n const processor = new EntityGroupProcessor()\n for (const tuples of entityGroups) {\n processor.processGroup(tuples)\n }\n processor.finalize()\n return processor.getEntities()\n}\n\nexport default function parseEntities(tuples: DXFTuple[]): Entity[] {\n const entityGroups: DXFTuple[][] = []\n let currentEntityTuples: DXFTuple[] = []\n\n // First group them together for easy processing\n for (const tuple of tuples) {\n const type = tuple[0]\n if (type === 0) {\n currentEntityTuples = []\n entityGroups.push(currentEntityTuples)\n }\n currentEntityTuples.push(tuple)\n }\n\n return processEntityGroups(entityGroups)\n}\n"],
5
+ "mappings": "AAIA,OAAO,YAAY;AACnB,OAAO,SAAS;AAChB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,iBAAiB;AACxB,OAAO,eAAe;AACtB,OAAO,iBAAiB;AACxB,OAAO,iBAAiB;AACxB,OAAO,aAAa;AACpB,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,O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