@linkiez/dxf-renew 7.1.0 → 7.2.3

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 (398) hide show
  1. package/.eslintrc.json +1 -16
  2. package/.yarn/install-state.gz +0 -0
  3. package/ARCHITECTURE.md +163 -0
  4. package/CHANGELOG.md +34 -0
  5. package/README.md +72 -10
  6. package/{PLAN.md → ROADMAP.md} +227 -35
  7. package/build.mjs +28 -0
  8. package/dist/dxf.js +1090 -344
  9. package/docs/FIXTURE_VALIDATION_EZDXF.md +1 -1
  10. package/lib/Helper.cjs +4 -0
  11. package/lib/Helper.cjs.map +3 -3
  12. package/lib/Helper.d.ts +19 -0
  13. package/lib/Helper.d.ts.map +1 -0
  14. package/lib/Helper.js +4 -0
  15. package/lib/Helper.js.map +2 -2
  16. package/lib/applyTransforms.d.ts +12 -0
  17. package/lib/applyTransforms.d.ts.map +1 -0
  18. package/lib/cli.cjs +1 -2
  19. package/lib/cli.cjs.map +1 -1
  20. package/lib/cli.d.ts +3 -0
  21. package/lib/cli.d.ts.map +1 -0
  22. package/lib/config.d.ts +4 -0
  23. package/lib/config.d.ts.map +1 -0
  24. package/lib/constants.d.ts +3 -0
  25. package/lib/constants.d.ts.map +1 -0
  26. package/lib/denormalise.d.ts +3 -0
  27. package/lib/denormalise.d.ts.map +1 -0
  28. package/lib/dimensionToSVG.d.ts +18 -0
  29. package/lib/dimensionToSVG.d.ts.map +1 -0
  30. package/lib/entityToPolyline.cjs +95 -0
  31. package/lib/entityToPolyline.cjs.map +3 -3
  32. package/lib/entityToPolyline.d.ts +48 -0
  33. package/lib/entityToPolyline.d.ts.map +1 -0
  34. package/lib/entityToPolyline.js +95 -0
  35. package/lib/entityToPolyline.js.map +2 -2
  36. package/lib/getRGBForEntity.d.ts +5 -0
  37. package/lib/getRGBForEntity.d.ts.map +1 -0
  38. package/lib/groupEntitiesByLayer.d.ts +3 -0
  39. package/lib/groupEntitiesByLayer.d.ts.map +1 -0
  40. package/lib/handlers/blocks.d.ts +3 -0
  41. package/lib/handlers/blocks.d.ts.map +1 -0
  42. package/lib/handlers/entities.cjs +22 -2
  43. package/lib/handlers/entities.cjs.map +3 -3
  44. package/lib/handlers/entities.d.ts +4 -0
  45. package/lib/handlers/entities.d.ts.map +1 -0
  46. package/lib/handlers/entities.js +22 -2
  47. package/lib/handlers/entities.js.map +2 -2
  48. package/lib/handlers/entity/arc.d.ts +20 -0
  49. package/lib/handlers/entity/arc.d.ts.map +1 -0
  50. package/lib/handlers/entity/attdef.d.ts +11 -0
  51. package/lib/handlers/entity/attdef.d.ts.map +1 -0
  52. package/lib/handlers/entity/attrib.d.ts +9 -0
  53. package/lib/handlers/entity/attrib.d.ts.map +1 -0
  54. package/lib/handlers/entity/circle.d.ts +17 -0
  55. package/lib/handlers/entity/circle.d.ts.map +1 -0
  56. package/lib/handlers/entity/common.d.ts +3 -0
  57. package/lib/handlers/entity/common.d.ts.map +1 -0
  58. package/lib/handlers/entity/dgnUnderlay.d.ts +33 -0
  59. package/lib/handlers/entity/dgnUnderlay.d.ts.map +1 -0
  60. package/lib/handlers/entity/dimension.d.ts +35 -0
  61. package/lib/handlers/entity/dimension.d.ts.map +1 -0
  62. package/lib/handlers/entity/dwfUnderlay.d.ts +33 -0
  63. package/lib/handlers/entity/dwfUnderlay.d.ts.map +1 -0
  64. package/lib/handlers/entity/ellipse.d.ts +10 -0
  65. package/lib/handlers/entity/ellipse.d.ts.map +1 -0
  66. package/lib/handlers/entity/hatch.d.ts +9 -0
  67. package/lib/handlers/entity/hatch.d.ts.map +1 -0
  68. package/lib/handlers/entity/image.d.ts +26 -0
  69. package/lib/handlers/entity/image.d.ts.map +1 -0
  70. package/lib/handlers/entity/insert.d.ts +10 -0
  71. package/lib/handlers/entity/insert.d.ts.map +1 -0
  72. package/lib/handlers/entity/leader.d.ts +48 -0
  73. package/lib/handlers/entity/leader.d.ts.map +1 -0
  74. package/lib/handlers/entity/line.d.ts +16 -0
  75. package/lib/handlers/entity/line.d.ts.map +1 -0
  76. package/lib/handlers/entity/lwpolyline.d.ts +10 -0
  77. package/lib/handlers/entity/lwpolyline.d.ts.map +1 -0
  78. package/lib/handlers/entity/mleader.cjs +69 -0
  79. package/lib/handlers/entity/mleader.cjs.map +7 -0
  80. package/lib/handlers/entity/mleader.d.ts +15 -0
  81. package/lib/handlers/entity/mleader.d.ts.map +1 -0
  82. package/lib/handlers/entity/mleader.js +34 -0
  83. package/lib/handlers/entity/mleader.js.map +7 -0
  84. package/lib/handlers/entity/mline.cjs +91 -0
  85. package/lib/handlers/entity/mline.cjs.map +7 -0
  86. package/lib/handlers/entity/mline.d.ts +17 -0
  87. package/lib/handlers/entity/mline.d.ts.map +1 -0
  88. package/lib/handlers/entity/mline.js +56 -0
  89. package/lib/handlers/entity/mline.js.map +7 -0
  90. package/lib/handlers/entity/mtext.d.ts +62 -0
  91. package/lib/handlers/entity/mtext.d.ts.map +1 -0
  92. package/lib/handlers/entity/ole2Frame.d.ts +9 -0
  93. package/lib/handlers/entity/ole2Frame.d.ts.map +1 -0
  94. package/lib/handlers/entity/oleframe.cjs +98 -0
  95. package/lib/handlers/entity/oleframe.cjs.map +7 -0
  96. package/lib/handlers/entity/oleframe.d.ts +9 -0
  97. package/lib/handlers/entity/oleframe.d.ts.map +1 -0
  98. package/lib/handlers/entity/oleframe.js +63 -0
  99. package/lib/handlers/entity/oleframe.js.map +7 -0
  100. package/lib/handlers/entity/pdfUnderlay.d.ts +33 -0
  101. package/lib/handlers/entity/pdfUnderlay.d.ts.map +1 -0
  102. package/lib/handlers/entity/point.d.ts +17 -0
  103. package/lib/handlers/entity/point.d.ts.map +1 -0
  104. package/lib/handlers/entity/polyline.d.ts +21 -0
  105. package/lib/handlers/entity/polyline.d.ts.map +1 -0
  106. package/lib/handlers/entity/ray.cjs +81 -0
  107. package/lib/handlers/entity/ray.cjs.map +7 -0
  108. package/lib/handlers/entity/ray.d.ts +15 -0
  109. package/lib/handlers/entity/ray.d.ts.map +1 -0
  110. package/lib/handlers/entity/ray.js +46 -0
  111. package/lib/handlers/entity/ray.js.map +7 -0
  112. package/lib/handlers/entity/region.cjs +67 -0
  113. package/lib/handlers/entity/region.cjs.map +7 -0
  114. package/lib/handlers/entity/region.d.ts +14 -0
  115. package/lib/handlers/entity/region.d.ts.map +1 -0
  116. package/lib/handlers/entity/region.js +32 -0
  117. package/lib/handlers/entity/region.js.map +7 -0
  118. package/lib/handlers/entity/shape.cjs +95 -0
  119. package/lib/handlers/entity/shape.cjs.map +7 -0
  120. package/lib/handlers/entity/shape.d.ts +22 -0
  121. package/lib/handlers/entity/shape.d.ts.map +1 -0
  122. package/lib/handlers/entity/shape.js +60 -0
  123. package/lib/handlers/entity/shape.js.map +7 -0
  124. package/lib/handlers/entity/solid.d.ts +15 -0
  125. package/lib/handlers/entity/solid.d.ts.map +1 -0
  126. package/lib/handlers/entity/spline.d.ts +30 -0
  127. package/lib/handlers/entity/spline.d.ts.map +1 -0
  128. package/lib/handlers/entity/table.cjs +71 -0
  129. package/lib/handlers/entity/table.cjs.map +7 -0
  130. package/lib/handlers/entity/table.d.ts +16 -0
  131. package/lib/handlers/entity/table.d.ts.map +1 -0
  132. package/lib/handlers/entity/table.js +36 -0
  133. package/lib/handlers/entity/table.js.map +7 -0
  134. package/lib/handlers/entity/text.d.ts +31 -0
  135. package/lib/handlers/entity/text.d.ts.map +1 -0
  136. package/lib/handlers/entity/threeDFace.d.ts +14 -0
  137. package/lib/handlers/entity/threeDFace.d.ts.map +1 -0
  138. package/lib/handlers/entity/tolerance.d.ts +25 -0
  139. package/lib/handlers/entity/tolerance.d.ts.map +1 -0
  140. package/lib/handlers/entity/trace.cjs +101 -0
  141. package/lib/handlers/entity/trace.cjs.map +7 -0
  142. package/lib/handlers/entity/trace.d.ts +15 -0
  143. package/lib/handlers/entity/trace.d.ts.map +1 -0
  144. package/lib/handlers/entity/trace.js +66 -0
  145. package/lib/handlers/entity/trace.js.map +7 -0
  146. package/lib/handlers/entity/vertex.d.ts +10 -0
  147. package/lib/handlers/entity/vertex.d.ts.map +1 -0
  148. package/lib/handlers/entity/viewport.d.ts +9 -0
  149. package/lib/handlers/entity/viewport.d.ts.map +1 -0
  150. package/lib/handlers/entity/wipeout.cjs +122 -0
  151. package/lib/handlers/entity/wipeout.cjs.map +7 -0
  152. package/lib/handlers/entity/wipeout.d.ts +28 -0
  153. package/lib/handlers/entity/wipeout.d.ts.map +1 -0
  154. package/lib/handlers/entity/wipeout.js +87 -0
  155. package/lib/handlers/entity/wipeout.js.map +7 -0
  156. package/lib/handlers/entity/xline.cjs +81 -0
  157. package/lib/handlers/entity/xline.cjs.map +7 -0
  158. package/lib/handlers/entity/xline.d.ts +15 -0
  159. package/lib/handlers/entity/xline.d.ts.map +1 -0
  160. package/lib/handlers/entity/xline.js +46 -0
  161. package/lib/handlers/entity/xline.js.map +7 -0
  162. package/lib/handlers/header.d.ts +3 -0
  163. package/lib/handlers/header.d.ts.map +1 -0
  164. package/lib/handlers/objects.cjs +43 -1
  165. package/lib/handlers/objects.cjs.map +2 -2
  166. package/lib/handlers/objects.d.ts +3 -0
  167. package/lib/handlers/objects.d.ts.map +1 -0
  168. package/lib/handlers/objects.js +43 -1
  169. package/lib/handlers/objects.js.map +2 -2
  170. package/lib/handlers/tables.cjs +96 -17
  171. package/lib/handlers/tables.cjs.map +2 -2
  172. package/lib/handlers/tables.d.ts +13 -0
  173. package/lib/handlers/tables.d.ts.map +1 -0
  174. package/lib/handlers/tables.js +96 -17
  175. package/lib/handlers/tables.js.map +2 -2
  176. package/lib/index.cjs +5 -2
  177. package/lib/index.cjs.map +3 -3
  178. package/lib/index.d.ts +10 -0
  179. package/lib/index.d.ts.map +1 -0
  180. package/lib/index.js +18 -16
  181. package/lib/index.js.map +3 -3
  182. package/lib/parseString.d.ts +3 -0
  183. package/lib/parseString.d.ts.map +1 -0
  184. package/lib/toJson.cjs +29 -0
  185. package/lib/toJson.cjs.map +7 -0
  186. package/lib/toJson.d.ts +3 -0
  187. package/lib/toJson.d.ts.map +1 -0
  188. package/lib/toJson.js +9 -0
  189. package/lib/toJson.js.map +7 -0
  190. package/lib/toPolylines.d.ts +4 -0
  191. package/lib/toPolylines.d.ts.map +1 -0
  192. package/lib/toSVG.cjs +34 -3
  193. package/lib/toSVG.cjs.map +2 -2
  194. package/lib/toSVG.d.ts +7 -0
  195. package/lib/toSVG.d.ts.map +1 -0
  196. package/lib/toSVG.js +34 -3
  197. package/lib/toSVG.js.map +2 -2
  198. package/lib/types/arc-entity.d.ts +8 -0
  199. package/lib/types/arc-entity.d.ts.map +1 -0
  200. package/lib/types/base-entity.d.ts +22 -0
  201. package/lib/types/base-entity.d.ts.map +1 -0
  202. package/lib/types/circle-entity.d.ts +6 -0
  203. package/lib/types/circle-entity.d.ts.map +1 -0
  204. package/lib/types/common.d.ts +30 -0
  205. package/lib/types/common.d.ts.map +1 -0
  206. package/lib/types/dimension-entity.d.ts +31 -0
  207. package/lib/types/dimension-entity.d.ts.map +1 -0
  208. package/lib/types/dxf.d.ts +55 -0
  209. package/lib/types/dxf.d.ts.map +1 -0
  210. package/lib/types/ellipse-entity.d.ts +11 -0
  211. package/lib/types/ellipse-entity.d.ts.map +1 -0
  212. package/lib/types/entity.cjs.map +1 -1
  213. package/lib/types/entity.d.ts +30 -0
  214. package/lib/types/entity.d.ts.map +1 -0
  215. package/lib/types/handler-internal.d.ts +44 -0
  216. package/lib/types/handler-internal.d.ts.map +1 -0
  217. package/lib/types/handler.d.ts +8 -0
  218. package/lib/types/handler.d.ts.map +1 -0
  219. package/lib/types/hatch-entity.d.ts +116 -0
  220. package/lib/types/hatch-entity.d.ts.map +1 -0
  221. package/lib/types/helper.cjs.map +1 -1
  222. package/lib/types/helper.d.ts +11 -0
  223. package/lib/types/helper.d.ts.map +1 -0
  224. package/lib/types/image-entity.d.ts +25 -0
  225. package/lib/types/image-entity.d.ts.map +1 -0
  226. package/lib/types/index.cjs +20 -0
  227. package/lib/types/index.cjs.map +2 -2
  228. package/lib/types/index.d.ts +43 -0
  229. package/lib/types/index.d.ts.map +1 -0
  230. package/lib/types/index.js +10 -0
  231. package/lib/types/index.js.map +2 -2
  232. package/lib/types/insert-entity.d.ts +16 -0
  233. package/lib/types/insert-entity.d.ts.map +1 -0
  234. package/lib/types/layer-groups.d.ts +6 -0
  235. package/lib/types/layer-groups.d.ts.map +1 -0
  236. package/lib/types/leader-entity.d.ts +28 -0
  237. package/lib/types/leader-entity.d.ts.map +1 -0
  238. package/lib/types/line-entity.d.ts +8 -0
  239. package/lib/types/line-entity.d.ts.map +1 -0
  240. package/lib/types/mleader-entity.cjs +17 -0
  241. package/lib/types/mleader-entity.cjs.map +7 -0
  242. package/lib/types/mleader-entity.d.ts +7 -0
  243. package/lib/types/mleader-entity.d.ts.map +1 -0
  244. package/lib/types/mleader-entity.js +1 -0
  245. package/lib/types/mleader-entity.js.map +7 -0
  246. package/lib/types/mline-entity.cjs +17 -0
  247. package/lib/types/mline-entity.cjs.map +7 -0
  248. package/lib/types/mline-entity.d.ts +10 -0
  249. package/lib/types/mline-entity.d.ts.map +1 -0
  250. package/lib/types/mline-entity.js +1 -0
  251. package/lib/types/mline-entity.js.map +7 -0
  252. package/lib/types/mtext-entity.d.ts +33 -0
  253. package/lib/types/mtext-entity.d.ts.map +1 -0
  254. package/lib/types/ole2frame-entity.d.ts +33 -0
  255. package/lib/types/ole2frame-entity.d.ts.map +1 -0
  256. package/lib/types/oleframe-entity.cjs +17 -0
  257. package/lib/types/oleframe-entity.cjs.map +7 -0
  258. package/lib/types/oleframe-entity.d.ts +33 -0
  259. package/lib/types/oleframe-entity.d.ts.map +1 -0
  260. package/lib/types/oleframe-entity.js +1 -0
  261. package/lib/types/oleframe-entity.js.map +7 -0
  262. package/lib/types/options.cjs.map +1 -1
  263. package/lib/types/options.d.ts +57 -0
  264. package/lib/types/options.d.ts.map +1 -0
  265. package/lib/types/point-entity.d.ts +5 -0
  266. package/lib/types/point-entity.d.ts.map +1 -0
  267. package/lib/types/polyline-entity.d.ts +17 -0
  268. package/lib/types/polyline-entity.d.ts.map +1 -0
  269. package/lib/types/polylines.d.ts +18 -0
  270. package/lib/types/polylines.d.ts.map +1 -0
  271. package/lib/types/ray-entity.cjs +17 -0
  272. package/lib/types/ray-entity.cjs.map +7 -0
  273. package/lib/types/ray-entity.d.ts +10 -0
  274. package/lib/types/ray-entity.d.ts.map +1 -0
  275. package/lib/types/ray-entity.js +1 -0
  276. package/lib/types/ray-entity.js.map +7 -0
  277. package/lib/types/region-entity.cjs +17 -0
  278. package/lib/types/region-entity.cjs.map +7 -0
  279. package/lib/types/region-entity.d.ts +10 -0
  280. package/lib/types/region-entity.d.ts.map +1 -0
  281. package/lib/types/region-entity.js +1 -0
  282. package/lib/types/region-entity.js.map +7 -0
  283. package/lib/types/shape-entity.cjs +17 -0
  284. package/lib/types/shape-entity.cjs.map +7 -0
  285. package/lib/types/shape-entity.d.ts +17 -0
  286. package/lib/types/shape-entity.d.ts.map +1 -0
  287. package/lib/types/shape-entity.js +1 -0
  288. package/lib/types/shape-entity.js.map +7 -0
  289. package/lib/types/solid-entity.d.ts +7 -0
  290. package/lib/types/solid-entity.d.ts.map +1 -0
  291. package/lib/types/spline-entity.d.ts +10 -0
  292. package/lib/types/spline-entity.d.ts.map +1 -0
  293. package/lib/types/svg.d.ts +27 -0
  294. package/lib/types/svg.d.ts.map +1 -0
  295. package/lib/types/table-entity.cjs +17 -0
  296. package/lib/types/table-entity.cjs.map +7 -0
  297. package/lib/types/table-entity.d.ts +12 -0
  298. package/lib/types/table-entity.d.ts.map +1 -0
  299. package/lib/types/table-entity.js +1 -0
  300. package/lib/types/table-entity.js.map +7 -0
  301. package/lib/types/tables.cjs.map +1 -1
  302. package/lib/types/tables.d.ts +549 -0
  303. package/lib/types/tables.d.ts.map +1 -0
  304. package/lib/types/text-entity.d.ts +21 -0
  305. package/lib/types/text-entity.d.ts.map +1 -0
  306. package/lib/types/tolerance-entity.d.ts +14 -0
  307. package/lib/types/tolerance-entity.d.ts.map +1 -0
  308. package/lib/types/trace-entity.cjs +17 -0
  309. package/lib/types/trace-entity.cjs.map +7 -0
  310. package/lib/types/trace-entity.d.ts +10 -0
  311. package/lib/types/trace-entity.d.ts.map +1 -0
  312. package/lib/types/trace-entity.js +1 -0
  313. package/lib/types/trace-entity.js.map +7 -0
  314. package/lib/types/underlay-entity.d.ts +26 -0
  315. package/lib/types/underlay-entity.d.ts.map +1 -0
  316. package/lib/types/util-types.d.ts +22 -0
  317. package/lib/types/util-types.d.ts.map +1 -0
  318. package/lib/types/viewport-entity.d.ts +79 -0
  319. package/lib/types/viewport-entity.d.ts.map +1 -0
  320. package/lib/types/wipeout-entity.cjs +17 -0
  321. package/lib/types/wipeout-entity.cjs.map +7 -0
  322. package/lib/types/wipeout-entity.d.ts +18 -0
  323. package/lib/types/wipeout-entity.d.ts.map +1 -0
  324. package/lib/types/wipeout-entity.js +1 -0
  325. package/lib/types/wipeout-entity.js.map +7 -0
  326. package/lib/types/xline-entity.cjs +17 -0
  327. package/lib/types/xline-entity.cjs.map +7 -0
  328. package/lib/types/xline-entity.d.ts +10 -0
  329. package/lib/types/xline-entity.d.ts.map +1 -0
  330. package/lib/types/xline-entity.js +1 -0
  331. package/lib/types/xline-entity.js.map +7 -0
  332. package/lib/types.d.ts +2 -0
  333. package/lib/types.d.ts.map +1 -0
  334. package/lib/util/bSpline.d.ts +8 -0
  335. package/lib/util/bSpline.d.ts.map +1 -0
  336. package/lib/util/colors.d.ts +5 -0
  337. package/lib/util/colors.d.ts.map +1 -0
  338. package/lib/util/createArcForLWPolyline.d.ts +9 -0
  339. package/lib/util/createArcForLWPolyline.d.ts.map +1 -0
  340. package/lib/util/dxfColorToRGB.d.ts +22 -0
  341. package/lib/util/dxfColorToRGB.d.ts.map +1 -0
  342. package/lib/util/escapeXmlText.d.ts +2 -0
  343. package/lib/util/escapeXmlText.d.ts.map +1 -0
  344. package/lib/util/insertKnot.d.ts +9 -0
  345. package/lib/util/insertKnot.d.ts.map +1 -0
  346. package/lib/util/logger.d.ts +10 -0
  347. package/lib/util/logger.d.ts.map +1 -0
  348. package/lib/util/rgbToColorAttribute.d.ts +7 -0
  349. package/lib/util/rgbToColorAttribute.d.ts.map +1 -0
  350. package/lib/util/rotate.d.ts +9 -0
  351. package/lib/util/rotate.d.ts.map +1 -0
  352. package/lib/util/round10.d.ts +2 -0
  353. package/lib/util/round10.d.ts.map +1 -0
  354. package/lib/util/toPiecewiseBezier.d.ts +18 -0
  355. package/lib/util/toPiecewiseBezier.d.ts.map +1 -0
  356. package/lib/util/transformBoundingBoxAndElement.d.ts +9 -0
  357. package/lib/util/transformBoundingBoxAndElement.d.ts.map +1 -0
  358. package/package.json +5 -19
  359. package/src/Helper.ts +6 -1
  360. package/src/entityToPolyline.ts +124 -2
  361. package/src/handlers/entities.ts +21 -1
  362. package/src/handlers/entity/mleader.ts +46 -0
  363. package/src/handlers/entity/mline.ts +74 -0
  364. package/src/handlers/entity/oleframe.ts +62 -0
  365. package/src/handlers/entity/ray.ts +52 -0
  366. package/src/handlers/entity/region.ts +42 -0
  367. package/src/handlers/entity/shape.ts +73 -0
  368. package/src/handlers/entity/table.ts +49 -0
  369. package/src/handlers/entity/trace.ts +72 -0
  370. package/src/handlers/entity/wipeout.ts +114 -0
  371. package/src/handlers/entity/xline.ts +52 -0
  372. package/src/handlers/objects.ts +64 -8
  373. package/src/handlers/tables.ts +134 -21
  374. package/src/index.ts +9 -18
  375. package/src/toJson.ts +8 -0
  376. package/src/toSVG.ts +45 -3
  377. package/src/types/entity.ts +20 -0
  378. package/src/types/helper.ts +2 -1
  379. package/src/types/index.ts +10 -0
  380. package/src/types/mleader-entity.ts +8 -0
  381. package/src/types/mline-entity.ts +12 -0
  382. package/src/types/oleframe-entity.ts +40 -0
  383. package/src/types/options.ts +7 -0
  384. package/src/types/ray-entity.ts +12 -0
  385. package/src/types/region-entity.ts +11 -0
  386. package/src/types/shape-entity.ts +19 -0
  387. package/src/types/table-entity.ts +14 -0
  388. package/src/types/tables.ts +76 -0
  389. package/src/types/trace-entity.ts +14 -0
  390. package/src/types/wipeout-entity.ts +20 -0
  391. package/src/types/xline-entity.ts +12 -0
  392. package/docs/DIMENSION_SUMMARY.md +0 -254
  393. package/docs/DXF_VERSION_SUPPORT.md +0 -45
  394. package/docs/ENTITY_SVG_ROADMAP.md +0 -96
  395. package/docs/IMPLEMENTED-2D-ENTITIES.md +0 -54
  396. package/docs/README.md +0 -22
  397. package/docs/SVG_RENDERING_INTEGRATION_TESTS.md +0 -119
  398. package/docs/TEXT-MTEXT-DIMENSION-SUPPORT.md +0 -241
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/entityToPolyline.ts"],
4
- "sourcesContent": ["import bSpline from './util/bSpline'\nimport createArcForLWPolyine from './util/createArcForLWPolyline'\nimport logger from './util/logger'\n\nimport type {\n ArcEntity,\n CircleEntity,\n ControlPoint,\n EllipseEntity,\n EntityToPolylineOptions,\n HandlerVertex,\n LineEntity,\n SplineEntity,\n} from './types'\nimport type { PointTuple } from './types/common'\n\n// Re-export types for backward compatibility\nexport type { ControlPoint, EntityToPolylineOptions } from './types'\n\ntype Point = PointTuple\n\n// Local vertex type with required coordinates for runtime processing\ninterface LocalVertex extends HandlerVertex {\n faces?: number[]\n}\n\n// Local polyline type that uses our vertex with required coordinates\ninterface LocalPolylineEntity {\n type: string\n vertices: LocalVertex[]\n closed?: boolean\n polyfaceMesh?: boolean\n polygonMesh?: boolean\n}\n\ntype Entity =\n | LineEntity\n | (LocalPolylineEntity & { type: 'LWPOLYLINE' | 'POLYLINE' })\n | CircleEntity\n | EllipseEntity\n | ArcEntity\n | SplineEntity\n\n/**\n * Rotate a set of points.\n *\n * @param points the points\n * @param angle the rotation angle\n */\nconst rotate = (points: Point[], angle: number): Point[] => {\n return points.map(function (p) {\n return [\n p[0] * Math.cos(angle) - p[1] * Math.sin(angle),\n p[1] * Math.cos(angle) + p[0] * Math.sin(angle),\n ]\n })\n}\n\n/**\n * Interpolate an ellipse\n * @param cx center X\n * @param cy center Y\n * @param rx radius X\n * @param ry radius Y\n * @param start start angle in radians\n * @param start end angle in radians\n */\nconst interpolateEllipse = (\n cx: number,\n cy: number,\n rx: number,\n ry: number,\n start: number,\n end: number,\n rotationAngle?: number\n): Point[] => {\n if (end < start) {\n end += Math.PI * 2\n }\n\n // ----- Relative points -----\n\n // Start point\n let points: Point[] = []\n const dTheta = (Math.PI * 2) / 72\n const EPS = 1e-6\n for (let theta = start; theta < end - EPS; theta += dTheta) {\n points.push([Math.cos(theta) * rx, Math.sin(theta) * ry])\n }\n points.push([Math.cos(end) * rx, Math.sin(end) * ry])\n\n // ----- Rotate -----\n if (rotationAngle) {\n points = rotate(points, rotationAngle)\n }\n\n // ----- Offset center -----\n points = points.map(function (p): Point {\n return [cx + p[0], cy + p[1]]\n })\n\n return points\n}\n\n/**\n * Interpolate a b-spline. The algorithm examins the knot vector\n * to create segments for interpolation. The parameterisation value\n * is re-normalised back to [0,1] as that is what the lib expects (\n * and t i de-normalised in the b-spline library)\n *\n * @param controlPoints the control points\n * @param degree the b-spline degree\n * @param knots the knot vector\n * @returns the polyline\n */\nexport const interpolateBSpline = (\n controlPoints: ControlPoint[],\n degree: number,\n knots: number[],\n interpolationsPerSplineSegment?: number,\n weights?: number[]\n): Point[] => {\n const polyline: Point[] = []\n const controlPointsForLib = controlPoints.map(function (p): Point {\n return [p.x, p.y]\n })\n\n const segmentTs = [knots[degree]]\n const domain: Point = [knots[degree], knots[knots.length - 1 - degree]]\n\n for (let k = degree + 1; k < knots.length - degree; ++k) {\n if (segmentTs[segmentTs.length - 1] !== knots[k]) {\n segmentTs.push(knots[k])\n }\n }\n\n interpolationsPerSplineSegment = interpolationsPerSplineSegment || 25\n for (let i = 1; i < segmentTs.length; ++i) {\n const uMin = segmentTs[i - 1]\n const uMax = segmentTs[i]\n for (let k = 0; k <= interpolationsPerSplineSegment; ++k) {\n const u = (k / interpolationsPerSplineSegment) * (uMax - uMin) + uMin\n // Clamp t to 0, 1 to handle numerical precision issues\n let t = (u - domain[0]) / (domain[1] - domain[0])\n t = Math.max(t, 0)\n t = Math.min(t, 1)\n const p = bSpline(t, degree, controlPointsForLib, knots, weights)\n polyline.push([p[0], p[1]])\n }\n }\n return polyline\n}\n\nexport const polyfaceOutline = (entity: LocalPolylineEntity): Point[][] => {\n const vertices: Array<{ x: number; y: number }> = []\n const faces: Array<{ indices: number[]; hiddens: boolean[] }> = []\n\n for (const v of entity.vertices) {\n if (v.faces) {\n const face: { indices: number[]; hiddens: boolean[] } = {\n indices: [],\n hiddens: [],\n }\n for (const i of v.faces) {\n if (i === 0) {\n break\n }\n // Negative indices signify hidden edges\n face.indices.push(i < 0 ? -i - 1 : i - 1)\n face.hiddens.push(i < 0)\n }\n if ([3, 4].includes(face.indices.length)) faces.push(face)\n } else {\n vertices.push({ x: v.x, y: v.y })\n }\n }\n\n // If a segment starts at the end of a previous line, continue it\n const polylines: number[][] = []\n const segment = (a: number, b: number): void => {\n for (const prev of polylines) {\n if (prev.slice(-1)[0] === a) {\n prev.push(b)\n return\n }\n }\n polylines.push([a, b])\n }\n\n for (const face of faces) {\n for (let beg = 0; beg < face.indices.length; beg++) {\n if (face.hiddens[beg]) {\n continue\n }\n const end = (beg + 1) % face.indices.length\n segment(face.indices[beg], face.indices[end])\n }\n }\n\n // Sometimes segments are not sequential, in that case\n // we need to find if they can mend gaps between others\n for (const a of polylines) {\n for (const b of polylines) {\n if (a !== b && a[0] === b.slice(-1)[0]) {\n b.push(...a.slice(1))\n a.splice(0, a.length)\n break\n }\n }\n }\n\n return polylines\n .filter((l) => l.length)\n .map((l) => l.map((i) => vertices[i]).map((v) => [v.x, v.y]))\n}\n\n/**\n * Convert a parsed DXF entity to a polyline. These can be used to render the\n * the DXF in SVG, Canvas, WebGL etc., without depending on native support\n * of primitive objects (ellispe, spline etc.)\n */\nexport default function entityToPolyline(\n entity: Entity,\n options?: EntityToPolylineOptions,\n): Point[] {\n options = options || {}\n let polyline: Point[] | undefined\n\n if (entity.type === 'LINE') {\n polyline = [\n [entity.start.x, entity.start.y],\n [entity.end.x, entity.end.y],\n ]\n }\n\n if (entity.type === 'LWPOLYLINE' || entity.type === 'POLYLINE') {\n polyline = []\n if (entity.polyfaceMesh) {\n // Only return the first polyline because we can't return many\n polyline.push(...polyfaceOutline(entity)[0])\n } else if (entity.polygonMesh) {\n // Do not attempt to render polygon meshes\n } else if (entity.vertices.length) {\n if (entity.closed) {\n entity.vertices = entity.vertices.concat(entity.vertices[0])\n }\n for (let i = 0, il = entity.vertices.length; i < il - 1; ++i) {\n const from: Point = [entity.vertices[i].x, entity.vertices[i].y]\n const to: Point = [entity.vertices[i + 1].x, entity.vertices[i + 1].y]\n polyline.push(from)\n if (entity.vertices[i].bulge) {\n polyline = polyline.concat(\n createArcForLWPolyine(from, to, entity.vertices[i].bulge!),\n )\n }\n // The last iteration of the for loop\n if (i === il - 2) {\n polyline.push(to)\n }\n }\n } else {\n logger.warn('Polyline entity with no vertices')\n }\n }\n\n if (entity.type === 'CIRCLE') {\n polyline = interpolateEllipse(\n entity.x,\n entity.y,\n entity.r,\n entity.r,\n 0,\n Math.PI * 2,\n )\n if (entity.extrusionZ === -1) {\n polyline = polyline.map(function (p): Point {\n return [-p[0], p[1]]\n })\n }\n }\n\n if (entity.type === 'ELLIPSE') {\n const rx = Math.hypot(entity.majorX, entity.majorY)\n const ry = entity.axisRatio * rx\n const majorAxisRotation = -Math.atan2(-entity.majorY, entity.majorX)\n polyline = interpolateEllipse(\n entity.x,\n entity.y,\n rx,\n ry,\n entity.startAngle,\n entity.endAngle,\n majorAxisRotation,\n )\n if (entity.extrusionZ === -1) {\n polyline = polyline.map(function (p): Point {\n return [-p[0], p[1]]\n })\n }\n }\n\n if (entity.type === 'ARC') {\n // Why on earth DXF has degree start & end angles for arc,\n // and radian start & end angles for ellipses is a mystery\n polyline = interpolateEllipse(\n entity.x,\n entity.y,\n entity.r,\n entity.r,\n entity.startAngle,\n entity.endAngle,\n )\n\n // I kid you not, ARCs and ELLIPSEs handle this differently,\n // as evidenced by how AutoCAD actually renders these entities\n if (entity.extrusionZ === -1) {\n polyline = polyline.map(function (p): Point {\n return [-p[0], p[1]]\n })\n }\n }\n\n if (entity.type === 'SPLINE') {\n polyline = interpolateBSpline(\n entity.controlPoints,\n entity.degree,\n entity.knots,\n options.interpolationsPerSplineSegment,\n entity.weights,\n )\n }\n\n if (!polyline) {\n logger.warn('unsupported entity for converting to polyline:', entity.type)\n return []\n }\n return polyline\n}\n"],
5
- "mappings": "AAAA,OAAO,aAAa;AACpB,OAAO,2BAA2B;AAClC,OAAO,YAAY;AA+CnB,MAAM,SAAS,CAAC,QAAiB,UAA2B;AAC1D,SAAO,OAAO,IAAI,SAAU,GAAG;AAC7B,WAAO;AAAA,MACL,EAAE,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC,IAAI,KAAK,IAAI,KAAK;AAAA,MAC9C,EAAE,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC,IAAI,KAAK,IAAI,KAAK;AAAA,IAChD;AAAA,EACF,CAAC;AACH;AAWA,MAAM,qBAAqB,CACzB,IACA,IACA,IACA,IACA,OACA,KACA,kBACY;AACZ,MAAI,MAAM,OAAO;AACf,WAAO,KAAK,KAAK;AAAA,EACnB;AAKA,MAAI,SAAkB,CAAC;AACvB,QAAM,SAAU,KAAK,KAAK,IAAK;AAC/B,QAAM,MAAM;AACZ,WAAS,QAAQ,OAAO,QAAQ,MAAM,KAAK,SAAS,QAAQ;AAC1D,WAAO,KAAK,CAAC,KAAK,IAAI,KAAK,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC;AAAA,EAC1D;AACA,SAAO,KAAK,CAAC,KAAK,IAAI,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG,IAAI,EAAE,CAAC;AAGpD,MAAI,eAAe;AACjB,aAAS,OAAO,QAAQ,aAAa;AAAA,EACvC;AAGA,W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AAG,EAAE,CAAC,CAAC;AAAA,MACrB,CAAC;AAAA,IACH;AAAA,EACF;AAEA,MAAI,OAAO,SAAS,UAAU;AAC5B,eAAW;AAAA,MACT,OAAO;AAAA,MACP,OAAO;AAAA,MACP,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,OAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI,CAAC,UAAU;AACb,WAAO,KAAK,kDAAkD,OAAO,IAAI;AACzE,WAAO,CAAC;AAAA,EACV;AACA,SAAO;AACT;",
4
+ "sourcesContent": ["import bSpline from './util/bSpline'\nimport createArcForLWPolyine from './util/createArcForLWPolyline'\nimport logger from './util/logger'\n\nimport type {\n ArcEntity,\n CircleEntity,\n ControlPoint,\n EllipseEntity,\n EntityToPolylineOptions,\n HandlerVertex,\n LeaderEntity,\n LineEntity,\n RayEntity,\n ShapeEntity,\n SplineEntity,\n WipeoutEntity,\n XLineEntity,\n} from './types'\nimport type { PointTuple } from './types/common'\n\n// Re-export types for backward compatibility\nexport type { ControlPoint, EntityToPolylineOptions } from './types'\n\ntype Point = PointTuple\n\n// Local vertex type with required coordinates for runtime processing\ninterface LocalVertex extends HandlerVertex {\n faces?: number[]\n}\n\n// Local polyline type that uses our vertex with required coordinates\ninterface LocalPolylineEntity {\n type: string\n vertices: LocalVertex[]\n closed?: boolean\n polyfaceMesh?: boolean\n polygonMesh?: boolean\n}\n\ntype Entity =\n | LineEntity\n | LeaderEntity\n | RayEntity\n | XLineEntity\n | ShapeEntity\n | WipeoutEntity\n | (LocalPolylineEntity & { type: 'LWPOLYLINE' | 'POLYLINE' })\n | {\n type: 'SOLID' | 'TRACE'\n corners?: Array<{ x: number; y: number }>\n points?: Array<{ x: number; y: number }>\n }\n | CircleEntity\n | EllipseEntity\n | ArcEntity\n | SplineEntity\n\n/**\n * Rotate a set of points.\n *\n * @param points the points\n * @param angle the rotation angle\n */\nconst rotate = (points: Point[], angle: number): Point[] => {\n return points.map(function (p) {\n return [\n p[0] * Math.cos(angle) - p[1] * Math.sin(angle),\n p[1] * Math.cos(angle) + p[0] * Math.sin(angle),\n ]\n })\n}\n\n/**\n * Interpolate an ellipse\n * @param cx center X\n * @param cy center Y\n * @param rx radius X\n * @param ry radius Y\n * @param start start angle in radians\n * @param start end angle in radians\n */\nconst interpolateEllipse = (\n cx: number,\n cy: number,\n rx: number,\n ry: number,\n start: number,\n end: number,\n rotationAngle?: number\n): Point[] => {\n if (end < start) {\n end += Math.PI * 2\n }\n\n // ----- Relative points -----\n\n // Start point\n let points: Point[] = []\n const dTheta = (Math.PI * 2) / 72\n const EPS = 1e-6\n for (let theta = start; theta < end - EPS; theta += dTheta) {\n points.push([Math.cos(theta) * rx, Math.sin(theta) * ry])\n }\n points.push([Math.cos(end) * rx, Math.sin(end) * ry])\n\n // ----- Rotate -----\n if (rotationAngle) {\n points = rotate(points, rotationAngle)\n }\n\n // ----- Offset center -----\n points = points.map(function (p): Point {\n return [cx + p[0], cy + p[1]]\n })\n\n return points\n}\n\n/**\n * Interpolate a b-spline. The algorithm examins the knot vector\n * to create segments for interpolation. The parameterisation value\n * is re-normalised back to [0,1] as that is what the lib expects (\n * and t i de-normalised in the b-spline library)\n *\n * @param controlPoints the control points\n * @param degree the b-spline degree\n * @param knots the knot vector\n * @returns the polyline\n */\nexport const interpolateBSpline = (\n controlPoints: ControlPoint[],\n degree: number,\n knots: number[],\n interpolationsPerSplineSegment?: number,\n weights?: number[]\n): Point[] => {\n const polyline: Point[] = []\n const controlPointsForLib = controlPoints.map(function (p): Point {\n return [p.x, p.y]\n })\n\n const segmentTs = [knots[degree]]\n const domain: Point = [knots[degree], knots[knots.length - 1 - degree]]\n\n for (let k = degree + 1; k < knots.length - degree; ++k) {\n if (segmentTs[segmentTs.length - 1] !== knots[k]) {\n segmentTs.push(knots[k])\n }\n }\n\n interpolationsPerSplineSegment = interpolationsPerSplineSegment || 25\n for (let i = 1; i < segmentTs.length; ++i) {\n const uMin = segmentTs[i - 1]\n const uMax = segmentTs[i]\n for (let k = 0; k <= interpolationsPerSplineSegment; ++k) {\n const u = (k / interpolationsPerSplineSegment) * (uMax - uMin) + uMin\n // Clamp t to 0, 1 to handle numerical precision issues\n let t = (u - domain[0]) / (domain[1] - domain[0])\n t = Math.max(t, 0)\n t = Math.min(t, 1)\n const p = bSpline(t, degree, controlPointsForLib, knots, weights)\n polyline.push([p[0], p[1]])\n }\n }\n return polyline\n}\n\nexport const polyfaceOutline = (entity: LocalPolylineEntity): Point[][] => { // NOSONAR\n const vertices: Array<{ x: number; y: number }> = []\n const faces: Array<{ indices: number[]; hiddens: boolean[] }> = []\n\n for (const v of entity.vertices) {\n if (v.faces) {\n const face: { indices: number[]; hiddens: boolean[] } = {\n indices: [],\n hiddens: [],\n }\n for (const i of v.faces) {\n if (i === 0) {\n break\n }\n // Negative indices signify hidden edges\n face.indices.push(i < 0 ? -i - 1 : i - 1)\n face.hiddens.push(i < 0)\n }\n if ([3, 4].includes(face.indices.length)) faces.push(face)\n } else {\n vertices.push({ x: v.x, y: v.y })\n }\n }\n\n // If a segment starts at the end of a previous line, continue it\n const polylines: number[][] = []\n const segment = (a: number, b: number): void => {\n for (const prev of polylines) {\n if (prev.slice(-1)[0] === a) {\n prev.push(b)\n return\n }\n }\n polylines.push([a, b])\n }\n\n for (const face of faces) {\n for (let beg = 0; beg < face.indices.length; beg++) {\n if (face.hiddens[beg]) {\n continue\n }\n const end = (beg + 1) % face.indices.length\n segment(face.indices[beg], face.indices[end])\n }\n }\n\n // Sometimes segments are not sequential, in that case\n // we need to find if they can mend gaps between others\n for (const a of polylines) {\n for (const b of polylines) {\n if (a !== b && a[0] === b.slice(-1)[0]) {\n b.push(...a.slice(1))\n a.splice(0, a.length)\n break\n }\n }\n }\n\n return polylines\n .filter((l) => l.length)\n .map((l) => l.map((i) => vertices[i]).map((v) => [v.x, v.y]))\n}\n\n/**\n * Convert a parsed DXF entity to a polyline. These can be used to render the\n * the DXF in SVG, Canvas, WebGL etc., without depending on native support\n * of primitive objects (ellispe, spline etc.)\n */\nexport default function entityToPolyline( // NOSONAR\n entity: Entity,\n options?: EntityToPolylineOptions,\n): Point[] {\n options = options || {}\n let polyline: Point[] | undefined\n\n const INFINITE_LINE_LENGTH = 1000\n\n const normalize2 = (x: number, y: number): { x: number; y: number } | null => {\n const len = Math.hypot(x, y)\n if (len === 0) return null\n return { x: x / len, y: y / len }\n }\n\n if (entity.type === 'LINE') {\n polyline = [\n [entity.start.x, entity.start.y],\n [entity.end.x, entity.end.y],\n ]\n }\n\n if (entity.type === 'LEADER') {\n if (entity.vertices.length >= 2) {\n polyline = entity.vertices.map((v) => [v.x, v.y])\n } else {\n logger.warn('LEADER entity with insufficient vertices')\n polyline = []\n }\n }\n\n if (entity.type === 'RAY') {\n const dir = normalize2(entity.direction.x, entity.direction.y)\n if (dir === null) {\n logger.warn('RAY entity with zero direction vector')\n polyline = []\n } else {\n polyline = [\n [entity.start.x, entity.start.y],\n [\n entity.start.x + dir.x * INFINITE_LINE_LENGTH,\n entity.start.y + dir.y * INFINITE_LINE_LENGTH,\n ],\n ]\n }\n }\n\n if (entity.type === 'XLINE') {\n const dir = normalize2(entity.direction.x, entity.direction.y)\n if (dir === null) {\n logger.warn('XLINE entity with zero direction vector')\n polyline = []\n } else {\n polyline = [\n [\n entity.basePoint.x - dir.x * INFINITE_LINE_LENGTH,\n entity.basePoint.y - dir.y * INFINITE_LINE_LENGTH,\n ],\n [\n entity.basePoint.x + dir.x * INFINITE_LINE_LENGTH,\n entity.basePoint.y + dir.y * INFINITE_LINE_LENGTH,\n ],\n ]\n }\n }\n\n if (entity.type === 'SHAPE') {\n const x = entity.insertionPoint?.x ?? 0\n const y = entity.insertionPoint?.y ?? 0\n const size = entity.size ?? 0\n const scaleX = entity.relativeXScale ?? 1\n const length = size * scaleX\n polyline = [\n [x, y],\n [x + length, y],\n ]\n }\n\n if (entity.type === 'WIPEOUT') {\n const verts = entity.clipBoundaryVertices\n if (!verts || verts.length < 2) {\n logger.warn('WIPEOUT entity with missing clip boundary vertices')\n polyline = []\n } else {\n const insX = entity.insertionPoint?.x ?? 0\n const insY = entity.insertionPoint?.y ?? 0\n\n const ux = entity.uVector?.x ?? 1\n const uy = entity.uVector?.y ?? 0\n\n const vx = entity.vVector?.x ?? 0\n const vy = entity.vVector?.y ?? 1\n\n polyline = verts.map((p) => [\n insX + ux * p.x + vx * p.y,\n insY + uy * p.x + vy * p.y,\n ])\n\n if (polyline.length > 0) {\n const first = polyline[0]\n const last = polyline[polyline.length - 1]\n if (first[0] !== last[0] || first[1] !== last[1]) {\n polyline.push(first)\n }\n }\n }\n }\n\n if (entity.type === 'LWPOLYLINE' || entity.type === 'POLYLINE') {\n polyline = []\n if (entity.polyfaceMesh) {\n // Only return the first polyline because we can't return many\n polyline.push(...polyfaceOutline(entity)[0])\n } else if (entity.polygonMesh) {\n // Do not attempt to render polygon meshes\n } else if (entity.vertices.length) {\n if (entity.closed) {\n entity.vertices = entity.vertices.concat(entity.vertices[0])\n }\n for (let i = 0, il = entity.vertices.length; i < il - 1; ++i) {\n const from: Point = [entity.vertices[i].x, entity.vertices[i].y]\n const to: Point = [entity.vertices[i + 1].x, entity.vertices[i + 1].y]\n polyline.push(from)\n if (entity.vertices[i].bulge) {\n polyline = polyline.concat(\n createArcForLWPolyine(from, to, entity.vertices[i].bulge!),\n )\n }\n // The last iteration of the for loop\n if (i === il - 2) {\n polyline.push(to)\n }\n }\n } else {\n logger.warn('Polyline entity with no vertices')\n }\n }\n\n if (entity.type === 'CIRCLE') {\n polyline = interpolateEllipse(\n entity.x,\n entity.y,\n entity.r,\n entity.r,\n 0,\n Math.PI * 2,\n )\n if (entity.extrusionZ === -1) {\n polyline = polyline.map(function (p): Point {\n return [-p[0], p[1]]\n })\n }\n }\n\n if (entity.type === 'ELLIPSE') {\n const rx = Math.hypot(entity.majorX, entity.majorY)\n const ry = entity.axisRatio * rx\n const majorAxisRotation = -Math.atan2(-entity.majorY, entity.majorX)\n polyline = interpolateEllipse(\n entity.x,\n entity.y,\n rx,\n ry,\n entity.startAngle,\n entity.endAngle,\n majorAxisRotation,\n )\n if (entity.extrusionZ === -1) {\n polyline = polyline.map(function (p): Point {\n return [-p[0], p[1]]\n })\n }\n }\n\n if (entity.type === 'ARC') {\n // Why on earth DXF has degree start & end angles for arc,\n // and radian start & end angles for ellipses is a mystery\n polyline = interpolateEllipse(\n entity.x,\n entity.y,\n entity.r,\n entity.r,\n entity.startAngle,\n entity.endAngle,\n )\n\n // I kid you not, ARCs and ELLIPSEs handle this differently,\n // as evidenced by how AutoCAD actually renders these entities\n if (entity.extrusionZ === -1) {\n polyline = polyline.map(function (p): Point {\n return [-p[0], p[1]]\n })\n }\n }\n\n if (entity.type === 'SPLINE') {\n polyline = interpolateBSpline(\n entity.controlPoints,\n entity.degree,\n entity.knots,\n options.interpolationsPerSplineSegment,\n entity.weights,\n )\n }\n\n if (entity.type === 'SOLID' || entity.type === 'TRACE') {\n const corners = entity.corners ?? entity.points\n if (corners && corners.length >= 4) {\n polyline = [\n [corners[0].x, corners[0].y],\n [corners[1].x, corners[1].y],\n [corners[2].x, corners[2].y],\n [corners[3].x, corners[3].y],\n [corners[0].x, corners[0].y],\n ]\n }\n }\n\n if (!polyline) {\n logger.warn('unsupported entity for converting to polyline:', entity.type)\n return []\n }\n return polyline\n}\n"],
5
+ "mappings": "AAAA,OAAO,aAAa;AACpB,OAAO,2BAA2B;AAClC,OAAO,YAAY;AA8DnB,MAAM,SAAS,CAAC,QAAiB,UAA2B;AAC1D,SAAO,OAAO,IAAI,SAAU,GAAG;AAC7B,WAAO;AAAA,MACL,EAAE,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC,IAAI,KAAK,IAAI,KAAK;AAAA,MAC9C,EAAE,CAAC,IAAI,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC,IAAI,KAAK,IAAI,KAAK;AAAA,IAChD;AAAA,EACF,CAAC;AACH;AAWA,MAAM,qBAAqB,CACzB,IACA,IACA,IACA,IACA,OACA,KACA,kB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1
+ import type { ColorRGB, Entity, LayerTable } from './types';
2
+ export default function getRGBForEntity(layers: {
3
+ [layerName: string]: LayerTable;
4
+ }, entity: Entity): ColorRGB;
5
+ //# sourceMappingURL=getRGBForEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRGBForEntity.d.ts","sourceRoot":"","sources":["../src/getRGBForEntity.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAE3D,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,MAAM,EAAE;IAAE,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,EAC3C,MAAM,EAAE,MAAM,GACb,QAAQ,CAmBV"}
@@ -0,0 +1,3 @@
1
+ import type { Entity, LayerGroups } from './types';
2
+ export default function groupEntitiesByLayer(entities: Entity[]): LayerGroups;
3
+ //# sourceMappingURL=groupEntitiesByLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groupEntitiesByLayer.d.ts","sourceRoot":"","sources":["../src/groupEntitiesByLayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAElD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,QAAQ,EAAE,MAAM,EAAE,GACjB,WAAW,CASb"}
@@ -0,0 +1,3 @@
1
+ import type { DXFTuple } from '../types';
2
+ export default function parseBlocks(tuples: DXFTuple[]): any[];
3
+ //# sourceMappingURL=blocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/handlers/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIvD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,EAAE,CA4D7D"}
@@ -39,7 +39,6 @@ var import_circle = __toESM(require("./entity/circle"), 1);
39
39
  var import_dgnUnderlay = __toESM(require("./entity/dgnUnderlay"), 1);
40
40
  var import_dimension = __toESM(require("./entity/dimension"), 1);
41
41
  var import_dwfUnderlay = __toESM(require("./entity/dwfUnderlay"), 1);
42
- var import_pdfUnderlay = __toESM(require("./entity/pdfUnderlay"), 1);
43
42
  var import_ellipse = __toESM(require("./entity/ellipse"), 1);
44
43
  var import_hatch = __toESM(require("./entity/hatch"), 1);
45
44
  var import_image = __toESM(require("./entity/image"), 1);
@@ -47,34 +46,52 @@ var import_insert = __toESM(require("./entity/insert"), 1);
47
46
  var import_leader = __toESM(require("./entity/leader"), 1);
48
47
  var import_line = __toESM(require("./entity/line"), 1);
49
48
  var import_lwpolyline = __toESM(require("./entity/lwpolyline"), 1);
49
+ var import_mleader = __toESM(require("./entity/mleader"), 1);
50
+ var import_mline = __toESM(require("./entity/mline"), 1);
50
51
  var import_mtext = __toESM(require("./entity/mtext"), 1);
51
52
  var import_ole2Frame = __toESM(require("./entity/ole2Frame"), 1);
53
+ var import_oleframe = __toESM(require("./entity/oleframe"), 1);
54
+ var import_pdfUnderlay = __toESM(require("./entity/pdfUnderlay"), 1);
52
55
  var import_point = __toESM(require("./entity/point"), 1);
53
56
  var import_polyline = __toESM(require("./entity/polyline"), 1);
57
+ var import_ray = __toESM(require("./entity/ray"), 1);
58
+ var import_region = __toESM(require("./entity/region"), 1);
59
+ var import_shape = __toESM(require("./entity/shape"), 1);
54
60
  var import_solid = __toESM(require("./entity/solid"), 1);
55
61
  var import_spline = __toESM(require("./entity/spline"), 1);
62
+ var import_table = __toESM(require("./entity/table"), 1);
56
63
  var import_text = __toESM(require("./entity/text"), 1);
57
64
  var import_threeDFace = __toESM(require("./entity/threeDFace"), 1);
58
65
  var import_tolerance = __toESM(require("./entity/tolerance"), 1);
66
+ var import_trace = __toESM(require("./entity/trace"), 1);
59
67
  var import_vertex = __toESM(require("./entity/vertex"), 1);
60
68
  var import_viewport = __toESM(require("./entity/viewport"), 1);
69
+ var import_wipeout = __toESM(require("./entity/wipeout"), 1);
70
+ var import_xline = __toESM(require("./entity/xline"), 1);
61
71
  const handlers = [
62
72
  import_point.default,
63
73
  import_line.default,
64
74
  import_lwpolyline.default,
75
+ import_mline.default,
76
+ import_mleader.default,
65
77
  import_polyline.default,
66
78
  import_vertex.default,
67
79
  import_circle.default,
68
80
  import_arc.default,
69
81
  import_ellipse.default,
70
82
  import_spline.default,
83
+ import_table.default,
71
84
  import_solid.default,
85
+ import_trace.default,
72
86
  import_hatch.default,
73
87
  import_image.default,
74
88
  import_leader.default,
89
+ import_ray.default,
90
+ import_region.default,
75
91
  import_dwfUnderlay.default,
76
92
  import_dgnUnderlay.default,
77
93
  import_pdfUnderlay.default,
94
+ import_shape.default,
78
95
  import_mtext.default,
79
96
  import_tolerance.default,
80
97
  import_attdef.default,
@@ -84,7 +101,10 @@ const handlers = [
84
101
  import_dimension.default,
85
102
  import_threeDFace.default,
86
103
  import_viewport.default,
87
- import_ole2Frame.default
104
+ import_ole2Frame.default,
105
+ import_oleframe.default,
106
+ import_xline.default,
107
+ import_wipeout.default
88
108
  ].reduce((acc, mod) => {
89
109
  acc[mod.TYPE] = mod;
90
110
  return acc;
@@ -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, 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;AAAA;AAAA;AAAA;AAAA;AAIA,oBAAmB;AACnB,iBAAgB;AAChB,oBAAmB;AACnB,oBAAmB;AACnB,oBAAmB;AACnB,yBAAwB;AACxB,uBAAsB;AACtB,yBA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AU,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"]
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 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 mleader from './entity/mleader'\nimport mline from './entity/mline'\nimport mtext from './entity/mtext'\nimport ole2Frame from './entity/ole2Frame'\nimport oleFrame from './entity/oleframe'\nimport pdfUnderlay from './entity/pdfUnderlay'\nimport point from './entity/point'\nimport polyline from './entity/polyline'\nimport ray from './entity/ray'\nimport region from './entity/region'\nimport shape from './entity/shape'\nimport solid from './entity/solid'\nimport spline from './entity/spline'\nimport table from './entity/table'\nimport text from './entity/text'\nimport threeDFace from './entity/threeDFace'\nimport tolerance from './entity/tolerance'\nimport trace from './entity/trace'\nimport vertex from './entity/vertex'\nimport viewport from './entity/viewport'\nimport wipeout from './entity/wipeout'\nimport xline from './entity/xline'\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 mline,\n mleader,\n polyline,\n vertex,\n circle,\n arc,\n ellipse,\n spline,\n table,\n solid,\n trace,\n hatch,\n image,\n leader,\n ray,\n region,\n dwfUnderlay,\n dgnUnderlay,\n pdfUnderlay,\n shape,\n mtext,\n tolerance,\n attdef,\n attrib,\n text,\n insert,\n dimension,\n threeDFace,\n viewport,\n ole2Frame,\n oleFrame,\n xline,\n wipeout,\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;AAAA;AAAA;AAAA;AAAA;AAIA,oBAAmB;AACnB,iBAAgB;AAChB,oBAAmB;AACnB,oBAAmB;AACnB,oBAAmB;AACnB,yBAAwB;AACxB,uBAAsB;AACtB,yBAAwB;AACxB,qBAAoB;AACpB,mBAAkB;AAClB,mBAAkB;AAClB,oBAA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AA,EAEQ,UAAU,YAAoB,eAAiC;AACrE,SAAK,kBAAkB,gEAAgE;AAEvF,UAAM,IAAI,KAAK,YAAY,YAAY,aAAa;AACpD,QAAI,CAAC,EAAG;AACR,SAAK,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", "mline", "mleader", "polyline", "vertex", "circle", "arc", "ellipse", "spline", "table", "solid", "trace", "hatch", "image", "leader", "ray", "region", "dwfUnderlay", "dgnUnderlay", "pdfUnderlay", "shape", "mtext", "tolerance", "attdef", "attrib", "text", "insert", "dimension", "threeDFace", "viewport", "ole2Frame", "oleFrame", "xline", "wipeout", "logger"]
7
7
  }
@@ -0,0 +1,4 @@
1
+ import type { DXFTuple } from '../types/dxf';
2
+ import type { Entity } from '../types/entity';
3
+ export default function parseEntities(tuples: DXFTuple[]): Entity[];
4
+ //# sourceMappingURL=entities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entities.d.ts","sourceRoot":"","sources":["../../src/handlers/entities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AA6L7C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CAelE"}
@@ -6,7 +6,6 @@ import circle from "./entity/circle";
6
6
  import dgnUnderlay from "./entity/dgnUnderlay";
7
7
  import dimension from "./entity/dimension";
8
8
  import dwfUnderlay from "./entity/dwfUnderlay";
9
- import pdfUnderlay from "./entity/pdfUnderlay";
10
9
  import ellipse from "./entity/ellipse";
11
10
  import hatch from "./entity/hatch";
12
11
  import image from "./entity/image";
@@ -14,34 +13,52 @@ import insert from "./entity/insert";
14
13
  import leader from "./entity/leader";
15
14
  import line from "./entity/line";
16
15
  import lwpolyline from "./entity/lwpolyline";
16
+ import mleader from "./entity/mleader";
17
+ import mline from "./entity/mline";
17
18
  import mtext from "./entity/mtext";
18
19
  import ole2Frame from "./entity/ole2Frame";
20
+ import oleFrame from "./entity/oleframe";
21
+ import pdfUnderlay from "./entity/pdfUnderlay";
19
22
  import point from "./entity/point";
20
23
  import polyline from "./entity/polyline";
24
+ import ray from "./entity/ray";
25
+ import region from "./entity/region";
26
+ import shape from "./entity/shape";
21
27
  import solid from "./entity/solid";
22
28
  import spline from "./entity/spline";
29
+ import table from "./entity/table";
23
30
  import text from "./entity/text";
24
31
  import threeDFace from "./entity/threeDFace";
25
32
  import tolerance from "./entity/tolerance";
33
+ import trace from "./entity/trace";
26
34
  import vertex from "./entity/vertex";
27
35
  import viewport from "./entity/viewport";
36
+ import wipeout from "./entity/wipeout";
37
+ import xline from "./entity/xline";
28
38
  const handlers = [
29
39
  point,
30
40
  line,
31
41
  lwpolyline,
42
+ mline,
43
+ mleader,
32
44
  polyline,
33
45
  vertex,
34
46
  circle,
35
47
  arc,
36
48
  ellipse,
37
49
  spline,
50
+ table,
38
51
  solid,
52
+ trace,
39
53
  hatch,
40
54
  image,
41
55
  leader,
56
+ ray,
57
+ region,
42
58
  dwfUnderlay,
43
59
  dgnUnderlay,
44
60
  pdfUnderlay,
61
+ shape,
45
62
  mtext,
46
63
  tolerance,
47
64
  attdef,
@@ -51,7 +68,10 @@ const handlers = [
51
68
  dimension,
52
69
  threeDFace,
53
70
  viewport,
54
- ole2Frame
71
+ ole2Frame,
72
+ oleFrame,
73
+ xline,
74
+ wipeout
55
75
  ].reduce((acc, mod) => {
56
76
  acc[mod.TYPE] = mod;
57
77
  return acc;
@@ -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, 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,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,eAAe;AACtB,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,E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tB;AAAA,EAEQ,UAAU,eAAiC;AACjD,UAAM,IAAI,KAAK,YAAY,UAAU,aAAa;AAClD,QAAI,CAAC,EAAG;AAER,QAAI,CAAC,KAAK,iBAAiB;AACzB,aAAO,MAAM,gCAAgC;AAC7C;AAAA,IACF;AAEA,SAAK,gBAAgB,SAAS,KAAK,CAAW;AAAA,EAChD;AAAA,EAEQ,UAAU,YAAoB,eAAiC;AACrE,SAAK,kBAAkB,gEAAgE;AAEvF,UAAM,IAAI,KAAK,YAAY,YAAY,aAAa;AACpD,QAAI,CAAC,EAAG;AACR,SAAK,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;",
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 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 mleader from './entity/mleader'\nimport mline from './entity/mline'\nimport mtext from './entity/mtext'\nimport ole2Frame from './entity/ole2Frame'\nimport oleFrame from './entity/oleframe'\nimport pdfUnderlay from './entity/pdfUnderlay'\nimport point from './entity/point'\nimport polyline from './entity/polyline'\nimport ray from './entity/ray'\nimport region from './entity/region'\nimport shape from './entity/shape'\nimport solid from './entity/solid'\nimport spline from './entity/spline'\nimport table from './entity/table'\nimport text from './entity/text'\nimport threeDFace from './entity/threeDFace'\nimport tolerance from './entity/tolerance'\nimport trace from './entity/trace'\nimport vertex from './entity/vertex'\nimport viewport from './entity/viewport'\nimport wipeout from './entity/wipeout'\nimport xline from './entity/xline'\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 mline,\n mleader,\n polyline,\n vertex,\n circle,\n arc,\n ellipse,\n spline,\n table,\n solid,\n trace,\n hatch,\n image,\n leader,\n ray,\n region,\n dwfUnderlay,\n dgnUnderlay,\n pdfUnderlay,\n shape,\n mtext,\n tolerance,\n attdef,\n attrib,\n text,\n insert,\n dimension,\n threeDFace,\n viewport,\n ole2Frame,\n oleFrame,\n xline,\n wipeout,\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,aAAa;AACpB,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,aAAa;AACpB,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB,OAAO,cAAc;AACrB,OAAO,iBAAiB;AACxB,OAAO,WAAW;AAClB,OAAO,cAAc;AACrB,OAAO,SAAS;AAChB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,UAAU;AACjB,OAAO,gBAAgB;AACvB,OAAO,eAAe;AACtB,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,cAAc;AACrB,OAAO,aAAa;AACpB,OAAO,WAAW;AAOlB,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;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;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AAO,MAAM,gCAAgC;AAC7C;AAAA,IACF;AAEA,SAAK,gBAAgB,SAAS,KAAK,CAAW;AAAA,EAChD;AAAA,EAEQ,UAAU,YAAoB,eAAiC;AACrE,SAAK,kBAAkB,gEAAgE;AAEvF,UAAM,IAAI,KAAK,YAAY,YAAY,aAAa;AACpD,QAAI,CAAC,EAAG;AACR,SAAK,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
6
  "names": []
7
7
  }
@@ -0,0 +1,20 @@
1
+ import type { DXFTuple } from '../../types/dxf';
2
+ export declare const TYPE = "ARC";
3
+ interface ArcEntity {
4
+ type: typeof TYPE;
5
+ x?: number;
6
+ y?: number;
7
+ z?: number;
8
+ thickness?: number;
9
+ r?: number;
10
+ startAngle?: number;
11
+ endAngle?: number;
12
+ [key: string]: unknown;
13
+ }
14
+ export declare const process: (tuples: DXFTuple[]) => ArcEntity;
15
+ declare const _default: {
16
+ TYPE: string;
17
+ process: (tuples: DXFTuple[]) => ArcEntity;
18
+ };
19
+ export default _default;
20
+ //# sourceMappingURL=arc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arc.d.ts","sourceRoot":"","sources":["../../../src/handlers/entity/arc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAI/C,eAAO,MAAM,IAAI,QAAQ,CAAA;AAGzB,UAAU,SAAS;IACjB,IAAI,EAAE,OAAO,IAAI,CAAA;IACjB,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,eAAO,MAAM,OAAO,GAAI,QAAQ,QAAQ,EAAE,KAAG,SAuC5C,CAAA;;;sBAvC+B,QAAQ,EAAE,KAAG,SAAS;;AAyCtD,wBAAgC"}
@@ -0,0 +1,11 @@
1
+ import type { DXFTuple } from '../../types/dxf';
2
+ export declare const TYPE = "ATTDEF";
3
+ export declare const process: (tuples: DXFTuple[]) => any;
4
+ export declare const assign: (entity: any, type: number, value: string | number) => void;
5
+ declare const _default: {
6
+ TYPE: string;
7
+ process: (tuples: DXFTuple[]) => any;
8
+ assign: (entity: any, type: number, value: string | number) => void;
9
+ };
10
+ export default _default;
11
+ //# sourceMappingURL=attdef.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attdef.d.ts","sourceRoot":"","sources":["../../../src/handlers/entity/attdef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAO/C,eAAO,MAAM,IAAI,WAAW,CAAA;AAE5B,eAAO,MAAM,OAAO,GAAI,QAAQ,QAAQ,EAAE,KAAG,GAmB5C,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,QAAQ,GAAG,EAAE,MAAM,MAAM,EAAE,OAAO,MAAM,GAAG,MAAM,KAAG,IA2P1E,CAAA;;;sBAhR+B,QAAQ,EAAE,KAAG,GAAG;qBAqBjB,GAAG,QAAQ,MAAM,SAAS,MAAM,GAAG,MAAM,KAAG,IAAI;;AA6P/E,wBAAwC"}
@@ -0,0 +1,9 @@
1
+ import type { DXFTuple } from '../../types/dxf';
2
+ export declare const TYPE = "ATTRIB";
3
+ export declare const process: (tuples: DXFTuple[]) => any;
4
+ declare const _default: {
5
+ TYPE: string;
6
+ process: (tuples: DXFTuple[]) => any;
7
+ };
8
+ export default _default;
9
+ //# sourceMappingURL=attrib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attrib.d.ts","sourceRoot":"","sources":["../../../src/handlers/entity/attrib.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAI/C,eAAO,MAAM,IAAI,WAAW,CAAA;AAG5B,eAAO,MAAM,OAAO,GAAI,QAAQ,QAAQ,EAAE,KAAG,GAmB5C,CAAA;;;sBAnB+B,QAAQ,EAAE,KAAG,GAAG;;AAqBhD,wBAAgC"}
@@ -0,0 +1,17 @@
1
+ import type { DXFTuple } from '../../types/dxf';
2
+ export declare const TYPE = "CIRCLE";
3
+ interface CircleEntity {
4
+ type: typeof TYPE;
5
+ x?: number;
6
+ y?: number;
7
+ z?: number;
8
+ r?: number;
9
+ [key: string]: unknown;
10
+ }
11
+ export declare const process: (tuples: DXFTuple[]) => CircleEntity;
12
+ declare const _default: {
13
+ TYPE: string;
14
+ process: (tuples: DXFTuple[]) => CircleEntity;
15
+ };
16
+ export default _default;
17
+ //# sourceMappingURL=circle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circle.d.ts","sourceRoot":"","sources":["../../../src/handlers/entity/circle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAI/C,eAAO,MAAM,IAAI,WAAW,CAAA;AAG5B,UAAU,YAAY;IACpB,IAAI,EAAE,OAAO,IAAI,CAAA;IACjB,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,CAAC,EAAE,MAAM,CAAA;IACV,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,eAAO,MAAM,OAAO,GAAI,QAAQ,QAAQ,EAAE,KAAG,YA4B5C,CAAA;;;sBA5B+B,QAAQ,EAAE,KAAG,YAAY;;AA8BzD,wBAAgC"}
@@ -0,0 +1,3 @@
1
+ import type { CommonEntityProperties } from '../../types/handler-internal';
2
+ export default function parseCommonEntityProperties(type: number, value: string | number): CommonEntityProperties;
3
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/handlers/entity/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAE1E,MAAM,CAAC,OAAO,UAAU,2BAA2B,CACjD,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,MAAM,GACrB,sBAAsB,CAyExB"}
@@ -0,0 +1,33 @@
1
+ import type { DXFTuple } from '../../types';
2
+ export declare const TYPE = "DGNUNDERLAY";
3
+ interface UnderlayEntity {
4
+ type: typeof TYPE;
5
+ insertionPoint: {
6
+ x: number;
7
+ y: number;
8
+ z: number;
9
+ };
10
+ scale: {
11
+ x: number;
12
+ y: number;
13
+ z: number;
14
+ };
15
+ normal: {
16
+ x: number;
17
+ y: number;
18
+ z: number;
19
+ };
20
+ underlayDefinitionHandle?: string;
21
+ rotation?: number;
22
+ flags?: number;
23
+ contrast?: number;
24
+ fade?: number;
25
+ [key: string]: unknown;
26
+ }
27
+ export declare const process: (tuples: DXFTuple[]) => UnderlayEntity;
28
+ declare const _default: {
29
+ TYPE: string;
30
+ process: (tuples: DXFTuple[]) => UnderlayEntity;
31
+ };
32
+ export default _default;
33
+ //# sourceMappingURL=dgnUnderlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dgnUnderlay.d.ts","sourceRoot":"","sources":["../../../src/handlers/entity/dgnUnderlay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAI3C,eAAO,MAAM,IAAI,gBAAgB,CAAA;AAEjC,UAAU,cAAc;IACtB,IAAI,EAAE,OAAO,IAAI,CAAA;IAEjB,cAAc,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACnD,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1C,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAE3C,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,eAAO,MAAM,OAAO,GAAI,QAAQ,QAAQ,EAAE,KAAG,cAqE5C,CAAA;;;sBArE+B,QAAQ,EAAE,KAAG,cAAc;;AAuE3D,wBAAgC"}
@@ -0,0 +1,35 @@
1
+ import type { DXFTuple } from '../../types/dxf';
2
+ export declare const TYPE = "DIMENSION";
3
+ interface Point3D {
4
+ x: number;
5
+ y: number;
6
+ z: number;
7
+ }
8
+ interface DimensionEntity {
9
+ type: typeof TYPE;
10
+ block?: string;
11
+ start: Point3D;
12
+ angleVertex?: Point3D;
13
+ arcPoint?: Point3D;
14
+ textMidpoint: Point3D;
15
+ measureStart: Point3D;
16
+ measureEnd: Point3D;
17
+ rotation?: number;
18
+ horizonRotation?: number;
19
+ extensionRotation?: number;
20
+ textRotation?: number;
21
+ ordinateType?: boolean;
22
+ uniqueBlockReference?: boolean;
23
+ userDefinedLocation?: boolean;
24
+ dimensionType: number;
25
+ attachementPoint: number;
26
+ extrudeDirection?: Point3D;
27
+ [key: string]: unknown;
28
+ }
29
+ export declare const process: (tuples: DXFTuple[]) => DimensionEntity;
30
+ declare const _default: {
31
+ TYPE: string;
32
+ process: (tuples: DXFTuple[]) => DimensionEntity;
33
+ };
34
+ export default _default;
35
+ //# sourceMappingURL=dimension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dimension.d.ts","sourceRoot":"","sources":["../../../src/handlers/entity/dimension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAI/C,eAAO,MAAM,IAAI,cAAc,CAAA;AAG/B,UAAU,OAAO;IACf,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,OAAO,IAAI,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,OAAO,CAAA;IACd,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,EAAE,OAAO,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AASD,eAAO,MAAM,OAAO,GAAI,QAAQ,QAAQ,EAAE,KAAG,eAgJ5C,CAAA;;;sBAhJ+B,QAAQ,EAAE,KAAG,eAAe;;AAwM5D,wBAAgC"}
@@ -0,0 +1,33 @@
1
+ import type { DXFTuple } from '../../types';
2
+ export declare const TYPE = "DWFUNDERLAY";
3
+ interface UnderlayEntity {
4
+ type: typeof TYPE;
5
+ insertionPoint: {
6
+ x: number;
7
+ y: number;
8
+ z: number;
9
+ };
10
+ scale: {
11
+ x: number;
12
+ y: number;
13
+ z: number;
14
+ };
15
+ normal: {
16
+ x: number;
17
+ y: number;
18
+ z: number;
19
+ };
20
+ underlayDefinitionHandle?: string;
21
+ rotation?: number;
22
+ flags?: number;
23
+ contrast?: number;
24
+ fade?: number;
25
+ [key: string]: unknown;
26
+ }
27
+ export declare const process: (tuples: DXFTuple[]) => UnderlayEntity;
28
+ declare const _default: {
29
+ TYPE: string;
30
+ process: (tuples: DXFTuple[]) => UnderlayEntity;
31
+ };
32
+ export default _default;
33
+ //# sourceMappingURL=dwfUnderlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dwfUnderlay.d.ts","sourceRoot":"","sources":["../../../src/handlers/entity/dwfUnderlay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAI3C,eAAO,MAAM,IAAI,gBAAgB,CAAA;AAEjC,UAAU,cAAc;IACtB,IAAI,EAAE,OAAO,IAAI,CAAA;IAEjB,cAAc,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACnD,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1C,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAE3C,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,eAAO,MAAM,OAAO,GAAI,QAAQ,QAAQ,EAAE,KAAG,cAqE5C,CAAA;;;sBArE+B,QAAQ,EAAE,KAAG,cAAc;;AAuE3D,wBAAgC"}
@@ -0,0 +1,10 @@
1
+ import type { DXFTuple } from '../../types/dxf';
2
+ import type { EllipseEntity } from '../../types';
3
+ export declare const TYPE = "ELLIPSE";
4
+ export declare const process: (tuples: DXFTuple[]) => EllipseEntity;
5
+ declare const _default: {
6
+ TYPE: string;
7
+ process: (tuples: DXFTuple[]) => EllipseEntity;
8
+ };
9
+ export default _default;
10
+ //# sourceMappingURL=ellipse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ellipse.d.ts","sourceRoot":"","sources":["../../../src/handlers/entity/ellipse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAI/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD,eAAO,MAAM,IAAI,YAAY,CAAA;AAG7B,eAAO,MAAM,OAAO,GAAI,QAAQ,QAAQ,EAAE,KAAG,aA2C5C,CAAA;;;sBA3C+B,QAAQ,EAAE,KAAG,aAAa;;AA6C1D,wBAAgC"}
@@ -0,0 +1,9 @@
1
+ import type { DXFTuple, HatchEntity } from '../../types';
2
+ export declare const TYPE = "HATCH";
3
+ export declare const process: (tuples: DXFTuple[]) => HatchEntity;
4
+ declare const _default: {
5
+ TYPE: string;
6
+ process: (tuples: DXFTuple[]) => HatchEntity;
7
+ };
8
+ export default _default;
9
+ //# sourceMappingURL=hatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hatch.d.ts","sourceRoot":"","sources":["../../../src/handlers/entity/hatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAwB,MAAM,aAAa,CAAA;AAI9E,eAAO,MAAM,IAAI,UAAU,CAAA;AAU3B,eAAO,MAAM,OAAO,GAAI,QAAQ,QAAQ,EAAE,KAAG,WA8P5C,CAAA;;;sBA9P+B,QAAQ,EAAE,KAAG,WAAW;;AAgQxD,wBAAgC"}