@mlightcad/data-model 1.3.3 → 1.3.4

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 (328) hide show
  1. package/dist/data-model.cjs +5 -0
  2. package/dist/data-model.js +25523 -0
  3. package/dist/dxf-parser-worker.js +1715 -0
  4. package/lib/base/AcDbHostApplicationServices.d.ts +96 -0
  5. package/lib/base/AcDbHostApplicationServices.d.ts.map +1 -0
  6. package/lib/base/AcDbHostApplicationServices.js +118 -0
  7. package/lib/base/AcDbHostApplicationServices.js.map +1 -0
  8. package/lib/base/AcDbObject.d.ts +205 -0
  9. package/lib/base/AcDbObject.d.ts.map +1 -0
  10. package/lib/base/AcDbObject.js +236 -0
  11. package/lib/base/AcDbObject.js.map +1 -0
  12. package/lib/base/index.d.ts +3 -0
  13. package/lib/base/index.d.ts.map +1 -0
  14. package/lib/base/index.js +3 -0
  15. package/lib/base/index.js.map +1 -0
  16. package/lib/converter/AcDbBatchProcessing.d.ts +146 -0
  17. package/lib/converter/AcDbBatchProcessing.d.ts.map +1 -0
  18. package/lib/converter/AcDbBatchProcessing.js +272 -0
  19. package/lib/converter/AcDbBatchProcessing.js.map +1 -0
  20. package/lib/converter/AcDbDxfConverter.d.ts +272 -0
  21. package/lib/converter/AcDbDxfConverter.d.ts.map +1 -0
  22. package/lib/converter/AcDbDxfConverter.js +874 -0
  23. package/lib/converter/AcDbDxfConverter.js.map +1 -0
  24. package/lib/converter/AcDbDxfParser.d.ts +23 -0
  25. package/lib/converter/AcDbDxfParser.d.ts.map +1 -0
  26. package/lib/converter/AcDbDxfParser.js +85 -0
  27. package/lib/converter/AcDbDxfParser.js.map +1 -0
  28. package/lib/converter/AcDbEntitiyConverter.d.ts +159 -0
  29. package/lib/converter/AcDbEntitiyConverter.d.ts.map +1 -0
  30. package/lib/converter/AcDbEntitiyConverter.js +659 -0
  31. package/lib/converter/AcDbEntitiyConverter.js.map +1 -0
  32. package/lib/converter/AcDbObjectConverter.d.ts +61 -0
  33. package/lib/converter/AcDbObjectConverter.d.ts.map +1 -0
  34. package/lib/converter/AcDbObjectConverter.js +91 -0
  35. package/lib/converter/AcDbObjectConverter.js.map +1 -0
  36. package/lib/converter/AcDbRegenerator.d.ts +101 -0
  37. package/lib/converter/AcDbRegenerator.d.ts.map +1 -0
  38. package/lib/converter/AcDbRegenerator.js +334 -0
  39. package/lib/converter/AcDbRegenerator.js.map +1 -0
  40. package/lib/converter/index.d.ts +5 -0
  41. package/lib/converter/index.d.ts.map +1 -0
  42. package/lib/converter/index.js +5 -0
  43. package/lib/converter/index.js.map +1 -0
  44. package/lib/converter/worker/AcDbBaseWorker.d.ts +36 -0
  45. package/lib/converter/worker/AcDbBaseWorker.d.ts.map +1 -0
  46. package/lib/converter/worker/AcDbBaseWorker.js +93 -0
  47. package/lib/converter/worker/AcDbBaseWorker.js.map +1 -0
  48. package/lib/converter/worker/AcDbDxfParserWorker.d.ts +11 -0
  49. package/lib/converter/worker/AcDbDxfParserWorker.d.ts.map +1 -0
  50. package/lib/converter/worker/AcDbDxfParserWorker.js +75 -0
  51. package/lib/converter/worker/AcDbDxfParserWorker.js.map +1 -0
  52. package/lib/converter/worker/AcDbWorkerManager.d.ts +107 -0
  53. package/lib/converter/worker/AcDbWorkerManager.d.ts.map +1 -0
  54. package/lib/converter/worker/AcDbWorkerManager.js +360 -0
  55. package/lib/converter/worker/AcDbWorkerManager.js.map +1 -0
  56. package/lib/converter/worker/index.d.ts +3 -0
  57. package/lib/converter/worker/index.d.ts.map +1 -0
  58. package/lib/converter/worker/index.js +3 -0
  59. package/lib/converter/worker/index.js.map +1 -0
  60. package/lib/database/AcDbBlockTable.d.ts +56 -0
  61. package/lib/database/AcDbBlockTable.d.ts.map +1 -0
  62. package/lib/database/AcDbBlockTable.js +98 -0
  63. package/lib/database/AcDbBlockTable.js.map +1 -0
  64. package/lib/database/AcDbBlockTableRecord.d.ts +185 -0
  65. package/lib/database/AcDbBlockTableRecord.d.ts.map +1 -0
  66. package/lib/database/AcDbBlockTableRecord.js +261 -0
  67. package/lib/database/AcDbBlockTableRecord.js.map +1 -0
  68. package/lib/database/AcDbDatabase.d.ts +563 -0
  69. package/lib/database/AcDbDatabase.d.ts.map +1 -0
  70. package/lib/database/AcDbDatabase.js +842 -0
  71. package/lib/database/AcDbDatabase.js.map +1 -0
  72. package/lib/database/AcDbDatabaseConverter.d.ts +292 -0
  73. package/lib/database/AcDbDatabaseConverter.d.ts.map +1 -0
  74. package/lib/database/AcDbDatabaseConverter.js +448 -0
  75. package/lib/database/AcDbDatabaseConverter.js.map +1 -0
  76. package/lib/database/AcDbDatabaseConverterManager.d.ts +141 -0
  77. package/lib/database/AcDbDatabaseConverterManager.d.ts.map +1 -0
  78. package/lib/database/AcDbDatabaseConverterManager.js +173 -0
  79. package/lib/database/AcDbDatabaseConverterManager.js.map +1 -0
  80. package/lib/database/AcDbDimStyleTable.d.ts +31 -0
  81. package/lib/database/AcDbDimStyleTable.d.ts.map +1 -0
  82. package/lib/database/AcDbDimStyleTable.js +49 -0
  83. package/lib/database/AcDbDimStyleTable.js.map +1 -0
  84. package/lib/database/AcDbDimStyleTableRecord.d.ts +797 -0
  85. package/lib/database/AcDbDimStyleTableRecord.d.ts.map +1 -0
  86. package/lib/database/AcDbDimStyleTableRecord.js +1294 -0
  87. package/lib/database/AcDbDimStyleTableRecord.js.map +1 -0
  88. package/lib/database/AcDbDwgVersion.d.ts +32 -0
  89. package/lib/database/AcDbDwgVersion.d.ts.map +1 -0
  90. package/lib/database/AcDbDwgVersion.js +126 -0
  91. package/lib/database/AcDbDwgVersion.js.map +1 -0
  92. package/lib/database/AcDbLayerTable.d.ts +51 -0
  93. package/lib/database/AcDbLayerTable.d.ts.map +1 -0
  94. package/lib/database/AcDbLayerTable.js +92 -0
  95. package/lib/database/AcDbLayerTable.js.map +1 -0
  96. package/lib/database/AcDbLayerTableRecord.d.ts +278 -0
  97. package/lib/database/AcDbLayerTableRecord.d.ts.map +1 -0
  98. package/lib/database/AcDbLayerTableRecord.js +397 -0
  99. package/lib/database/AcDbLayerTableRecord.js.map +1 -0
  100. package/lib/database/AcDbLinetypeTable.d.ts +30 -0
  101. package/lib/database/AcDbLinetypeTable.d.ts.map +1 -0
  102. package/lib/database/AcDbLinetypeTable.js +48 -0
  103. package/lib/database/AcDbLinetypeTable.js.map +1 -0
  104. package/lib/database/AcDbLinetypeTableRecord.d.ts +79 -0
  105. package/lib/database/AcDbLinetypeTableRecord.d.ts.map +1 -0
  106. package/lib/database/AcDbLinetypeTableRecord.js +129 -0
  107. package/lib/database/AcDbLinetypeTableRecord.js.map +1 -0
  108. package/lib/database/AcDbSymbolTable.d.ts +199 -0
  109. package/lib/database/AcDbSymbolTable.d.ts.map +1 -0
  110. package/lib/database/AcDbSymbolTable.js +264 -0
  111. package/lib/database/AcDbSymbolTable.js.map +1 -0
  112. package/lib/database/AcDbSymbolTableRecord.d.ts +61 -0
  113. package/lib/database/AcDbSymbolTableRecord.d.ts.map +1 -0
  114. package/lib/database/AcDbSymbolTableRecord.js +82 -0
  115. package/lib/database/AcDbSymbolTableRecord.js.map +1 -0
  116. package/lib/database/AcDbTextStyleTable.d.ts +48 -0
  117. package/lib/database/AcDbTextStyleTable.d.ts.map +1 -0
  118. package/lib/database/AcDbTextStyleTable.js +112 -0
  119. package/lib/database/AcDbTextStyleTable.js.map +1 -0
  120. package/lib/database/AcDbTextStyleTableRecord.d.ts +179 -0
  121. package/lib/database/AcDbTextStyleTableRecord.d.ts.map +1 -0
  122. package/lib/database/AcDbTextStyleTableRecord.js +276 -0
  123. package/lib/database/AcDbTextStyleTableRecord.js.map +1 -0
  124. package/lib/database/AcDbViewportTable.d.ts +31 -0
  125. package/lib/database/AcDbViewportTable.d.ts.map +1 -0
  126. package/lib/database/AcDbViewportTable.js +49 -0
  127. package/lib/database/AcDbViewportTable.js.map +1 -0
  128. package/lib/database/AcDbViewportTableRecord.d.ts +154 -0
  129. package/lib/database/AcDbViewportTableRecord.d.ts.map +1 -0
  130. package/lib/database/AcDbViewportTableRecord.js +318 -0
  131. package/lib/database/AcDbViewportTableRecord.js.map +1 -0
  132. package/lib/database/index.d.ts +19 -0
  133. package/lib/database/index.d.ts.map +1 -0
  134. package/lib/database/index.js +19 -0
  135. package/lib/database/index.js.map +1 -0
  136. package/lib/entity/AcDbArc.d.ts +254 -0
  137. package/lib/entity/AcDbArc.d.ts.map +1 -0
  138. package/lib/entity/AcDbArc.js +340 -0
  139. package/lib/entity/AcDbArc.js.map +1 -0
  140. package/lib/entity/AcDbBlockReference.d.ts +190 -0
  141. package/lib/entity/AcDbBlockReference.d.ts.map +1 -0
  142. package/lib/entity/AcDbBlockReference.js +302 -0
  143. package/lib/entity/AcDbBlockReference.js.map +1 -0
  144. package/lib/entity/AcDbCircle.d.ts +186 -0
  145. package/lib/entity/AcDbCircle.d.ts.map +1 -0
  146. package/lib/entity/AcDbCircle.js +249 -0
  147. package/lib/entity/AcDbCircle.js.map +1 -0
  148. package/lib/entity/AcDbCurve.d.ts +42 -0
  149. package/lib/entity/AcDbCurve.d.ts.map +1 -0
  150. package/lib/entity/AcDbCurve.js +44 -0
  151. package/lib/entity/AcDbCurve.js.map +1 -0
  152. package/lib/entity/AcDbEllipse.d.ts +207 -0
  153. package/lib/entity/AcDbEllipse.d.ts.map +1 -0
  154. package/lib/entity/AcDbEllipse.js +272 -0
  155. package/lib/entity/AcDbEllipse.js.map +1 -0
  156. package/lib/entity/AcDbEntity.d.ts +385 -0
  157. package/lib/entity/AcDbEntity.d.ts.map +1 -0
  158. package/lib/entity/AcDbEntity.js +561 -0
  159. package/lib/entity/AcDbEntity.js.map +1 -0
  160. package/lib/entity/AcDbFace.d.ts +151 -0
  161. package/lib/entity/AcDbFace.d.ts.map +1 -0
  162. package/lib/entity/AcDbFace.js +224 -0
  163. package/lib/entity/AcDbFace.js.map +1 -0
  164. package/lib/entity/AcDbHatch.d.ts +174 -0
  165. package/lib/entity/AcDbHatch.d.ts.map +1 -0
  166. package/lib/entity/AcDbHatch.js +250 -0
  167. package/lib/entity/AcDbHatch.js.map +1 -0
  168. package/lib/entity/AcDbLeader.d.ts +243 -0
  169. package/lib/entity/AcDbLeader.d.ts.map +1 -0
  170. package/lib/entity/AcDbLeader.js +358 -0
  171. package/lib/entity/AcDbLeader.js.map +1 -0
  172. package/lib/entity/AcDbLine.d.ts +198 -0
  173. package/lib/entity/AcDbLine.d.ts.map +1 -0
  174. package/lib/entity/AcDbLine.js +300 -0
  175. package/lib/entity/AcDbLine.js.map +1 -0
  176. package/lib/entity/AcDbMText.d.ts +248 -0
  177. package/lib/entity/AcDbMText.d.ts.map +1 -0
  178. package/lib/entity/AcDbMText.js +414 -0
  179. package/lib/entity/AcDbMText.js.map +1 -0
  180. package/lib/entity/AcDbPoint.d.ts +113 -0
  181. package/lib/entity/AcDbPoint.d.ts.map +1 -0
  182. package/lib/entity/AcDbPoint.js +155 -0
  183. package/lib/entity/AcDbPoint.js.map +1 -0
  184. package/lib/entity/AcDbPolyline.d.ts +221 -0
  185. package/lib/entity/AcDbPolyline.d.ts.map +1 -0
  186. package/lib/entity/AcDbPolyline.js +301 -0
  187. package/lib/entity/AcDbPolyline.js.map +1 -0
  188. package/lib/entity/AcDbRasterImage.d.ts +216 -0
  189. package/lib/entity/AcDbRasterImage.d.ts.map +1 -0
  190. package/lib/entity/AcDbRasterImage.js +451 -0
  191. package/lib/entity/AcDbRasterImage.js.map +1 -0
  192. package/lib/entity/AcDbRay.d.ts +150 -0
  193. package/lib/entity/AcDbRay.d.ts.map +1 -0
  194. package/lib/entity/AcDbRay.js +208 -0
  195. package/lib/entity/AcDbRay.js.map +1 -0
  196. package/lib/entity/AcDbSpline.d.ts +135 -0
  197. package/lib/entity/AcDbSpline.d.ts.map +1 -0
  198. package/lib/entity/AcDbSpline.js +142 -0
  199. package/lib/entity/AcDbSpline.js.map +1 -0
  200. package/lib/entity/AcDbTable.d.ts +260 -0
  201. package/lib/entity/AcDbTable.d.ts.map +1 -0
  202. package/lib/entity/AcDbTable.js +452 -0
  203. package/lib/entity/AcDbTable.js.map +1 -0
  204. package/lib/entity/AcDbText.d.ts +388 -0
  205. package/lib/entity/AcDbText.d.ts.map +1 -0
  206. package/lib/entity/AcDbText.js +523 -0
  207. package/lib/entity/AcDbText.js.map +1 -0
  208. package/lib/entity/AcDbTrace.d.ts +193 -0
  209. package/lib/entity/AcDbTrace.d.ts.map +1 -0
  210. package/lib/entity/AcDbTrace.js +271 -0
  211. package/lib/entity/AcDbTrace.js.map +1 -0
  212. package/lib/entity/AcDbViewport.d.ts +173 -0
  213. package/lib/entity/AcDbViewport.d.ts.map +1 -0
  214. package/lib/entity/AcDbViewport.js +295 -0
  215. package/lib/entity/AcDbViewport.js.map +1 -0
  216. package/lib/entity/AcDbWipeout.d.ts +39 -0
  217. package/lib/entity/AcDbWipeout.d.ts.map +1 -0
  218. package/lib/entity/AcDbWipeout.js +70 -0
  219. package/lib/entity/AcDbWipeout.js.map +1 -0
  220. package/lib/entity/AcDbXline.d.ts +151 -0
  221. package/lib/entity/AcDbXline.d.ts.map +1 -0
  222. package/lib/entity/AcDbXline.js +209 -0
  223. package/lib/entity/AcDbXline.js.map +1 -0
  224. package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts +92 -0
  225. package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts.map +1 -0
  226. package/lib/entity/dimension/AcDb3PointAngularDimension.js +157 -0
  227. package/lib/entity/dimension/AcDb3PointAngularDimension.js.map +1 -0
  228. package/lib/entity/dimension/AcDbAlignedDimension.d.ts +220 -0
  229. package/lib/entity/dimension/AcDbAlignedDimension.d.ts.map +1 -0
  230. package/lib/entity/dimension/AcDbAlignedDimension.js +341 -0
  231. package/lib/entity/dimension/AcDbAlignedDimension.js.map +1 -0
  232. package/lib/entity/dimension/AcDbArcDimension.d.ts +94 -0
  233. package/lib/entity/dimension/AcDbArcDimension.d.ts.map +1 -0
  234. package/lib/entity/dimension/AcDbArcDimension.js +159 -0
  235. package/lib/entity/dimension/AcDbArcDimension.js.map +1 -0
  236. package/lib/entity/dimension/AcDbDiametricDimension.d.ts +145 -0
  237. package/lib/entity/dimension/AcDbDiametricDimension.d.ts.map +1 -0
  238. package/lib/entity/dimension/AcDbDiametricDimension.js +275 -0
  239. package/lib/entity/dimension/AcDbDiametricDimension.js.map +1 -0
  240. package/lib/entity/dimension/AcDbDimension.d.ts +257 -0
  241. package/lib/entity/dimension/AcDbDimension.d.ts.map +1 -0
  242. package/lib/entity/dimension/AcDbDimension.js +466 -0
  243. package/lib/entity/dimension/AcDbDimension.js.map +1 -0
  244. package/lib/entity/dimension/AcDbOrdinateDimension.d.ts +78 -0
  245. package/lib/entity/dimension/AcDbOrdinateDimension.d.ts.map +1 -0
  246. package/lib/entity/dimension/AcDbOrdinateDimension.js +133 -0
  247. package/lib/entity/dimension/AcDbOrdinateDimension.js.map +1 -0
  248. package/lib/entity/dimension/AcDbRadialDimension.d.ts +214 -0
  249. package/lib/entity/dimension/AcDbRadialDimension.d.ts.map +1 -0
  250. package/lib/entity/dimension/AcDbRadialDimension.js +288 -0
  251. package/lib/entity/dimension/AcDbRadialDimension.js.map +1 -0
  252. package/lib/entity/dimension/index.d.ts +8 -0
  253. package/lib/entity/dimension/index.d.ts.map +1 -0
  254. package/lib/entity/dimension/index.js +8 -0
  255. package/lib/entity/dimension/index.js.map +1 -0
  256. package/lib/entity/index.d.ts +24 -0
  257. package/lib/entity/index.d.ts.map +1 -0
  258. package/lib/entity/index.js +24 -0
  259. package/lib/entity/index.js.map +1 -0
  260. package/lib/index.d.ts +10 -0
  261. package/lib/index.d.ts.map +1 -0
  262. package/lib/index.js +10 -0
  263. package/lib/index.js.map +1 -0
  264. package/lib/misc/AcDbAngleUnits.d.ts +20 -0
  265. package/lib/misc/AcDbAngleUnits.d.ts.map +1 -0
  266. package/lib/misc/AcDbAngleUnits.js +21 -0
  267. package/lib/misc/AcDbAngleUnits.js.map +1 -0
  268. package/lib/misc/AcDbCodePage.d.ts +50 -0
  269. package/lib/misc/AcDbCodePage.d.ts.map +1 -0
  270. package/lib/misc/AcDbCodePage.js +100 -0
  271. package/lib/misc/AcDbCodePage.js.map +1 -0
  272. package/lib/misc/AcDbConstants.d.ts +24 -0
  273. package/lib/misc/AcDbConstants.d.ts.map +1 -0
  274. package/lib/misc/AcDbConstants.js +24 -0
  275. package/lib/misc/AcDbConstants.js.map +1 -0
  276. package/lib/misc/AcDbDimArrowType.d.ts +89 -0
  277. package/lib/misc/AcDbDimArrowType.d.ts.map +1 -0
  278. package/lib/misc/AcDbDimArrowType.js +90 -0
  279. package/lib/misc/AcDbDimArrowType.js.map +1 -0
  280. package/lib/misc/AcDbObjectIterator.d.ts +64 -0
  281. package/lib/misc/AcDbObjectIterator.d.ts.map +1 -0
  282. package/lib/misc/AcDbObjectIterator.js +84 -0
  283. package/lib/misc/AcDbObjectIterator.js.map +1 -0
  284. package/lib/misc/AcDbOsnapMode.d.ts +51 -0
  285. package/lib/misc/AcDbOsnapMode.d.ts.map +1 -0
  286. package/lib/misc/AcDbOsnapMode.js +52 -0
  287. package/lib/misc/AcDbOsnapMode.js.map +1 -0
  288. package/lib/misc/AcDbRenderingCache.d.ts +141 -0
  289. package/lib/misc/AcDbRenderingCache.d.ts.map +1 -0
  290. package/lib/misc/AcDbRenderingCache.js +239 -0
  291. package/lib/misc/AcDbRenderingCache.js.map +1 -0
  292. package/lib/misc/AcDbUnitsValue.d.ts +101 -0
  293. package/lib/misc/AcDbUnitsValue.d.ts.map +1 -0
  294. package/lib/misc/AcDbUnitsValue.js +121 -0
  295. package/lib/misc/AcDbUnitsValue.js.map +1 -0
  296. package/lib/misc/index.d.ts +9 -0
  297. package/lib/misc/index.d.ts.map +1 -0
  298. package/lib/misc/index.js +9 -0
  299. package/lib/misc/index.js.map +1 -0
  300. package/lib/object/AcDbDictionary.d.ts +178 -0
  301. package/lib/object/AcDbDictionary.d.ts.map +1 -0
  302. package/lib/object/AcDbDictionary.js +264 -0
  303. package/lib/object/AcDbDictionary.js.map +1 -0
  304. package/lib/object/AcDbRasterImageDef.d.ts +54 -0
  305. package/lib/object/AcDbRasterImageDef.d.ts.map +1 -0
  306. package/lib/object/AcDbRasterImageDef.js +82 -0
  307. package/lib/object/AcDbRasterImageDef.js.map +1 -0
  308. package/lib/object/index.d.ts +4 -0
  309. package/lib/object/index.d.ts.map +1 -0
  310. package/lib/object/index.js +4 -0
  311. package/lib/object/index.js.map +1 -0
  312. package/lib/object/layout/AcDbLayout.d.ts +190 -0
  313. package/lib/object/layout/AcDbLayout.d.ts.map +1 -0
  314. package/lib/object/layout/AcDbLayout.js +253 -0
  315. package/lib/object/layout/AcDbLayout.js.map +1 -0
  316. package/lib/object/layout/AcDbLayoutDictionary.d.ts +47 -0
  317. package/lib/object/layout/AcDbLayoutDictionary.d.ts.map +1 -0
  318. package/lib/object/layout/AcDbLayoutDictionary.js +122 -0
  319. package/lib/object/layout/AcDbLayoutDictionary.js.map +1 -0
  320. package/lib/object/layout/AcDbLayoutManager.d.ts +188 -0
  321. package/lib/object/layout/AcDbLayoutManager.d.ts.map +1 -0
  322. package/lib/object/layout/AcDbLayoutManager.js +245 -0
  323. package/lib/object/layout/AcDbLayoutManager.js.map +1 -0
  324. package/lib/object/layout/index.d.ts +4 -0
  325. package/lib/object/layout/index.d.ts.map +1 -0
  326. package/lib/object/layout/index.js +4 -0
  327. package/lib/object/layout/index.js.map +1 -0
  328. package/package.json +4 -4
@@ -0,0 +1,659 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { AcGeCircArc2d, AcGeEllipseArc2d, AcGeLine2d, AcGeLoop2d, AcGeMathUtil, AcGePoint2d, AcGePoint3d, AcGePolyline2d, AcGeSpline3d, AcGeVector2d, AcGeVector3d } from '@mlightcad/geometry-engine';
13
+ import { AcDb3PointAngularDimension, AcDbAlignedDimension, AcDbArc, AcDbBlockReference, AcDbCircle, AcDbDiametricDimension, AcDbEllipse, AcDbFace, AcDbHatch, AcDbLeader, AcDbLine, AcDbMText, AcDbOrdinateDimension, AcDbPoint, AcDbPolyline, AcDbRadialDimension, AcDbRasterImage, AcDbRay, AcDbSpline, AcDbTable, AcDbText, AcDbTrace, AcDbViewport, AcDbWipeout, AcDbXline } from '../entity';
14
+ /**
15
+ * Converts DXF entities to AcDbEntity objects.
16
+ *
17
+ * This class provides functionality to convert various DXF entity types
18
+ * (such as lines, circles, arcs, text, etc.) into their corresponding
19
+ * AcDbEntity objects. It handles the conversion of geometric data,
20
+ * properties, and attributes from DXF format to the internal database format.
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const converter = new AcDbEntityConverter();
25
+ * const dxfEntity = { type: 'LINE', startPoint: [0, 0, 0], endPoint: [10, 10, 0] };
26
+ * const acDbEntity = converter.convert(dxfEntity);
27
+ * ```
28
+ */
29
+ var AcDbEntityConverter = /** @class */ (function () {
30
+ function AcDbEntityConverter() {
31
+ }
32
+ /**
33
+ * Converts a DXF entity to an AcDbEntity.
34
+ *
35
+ * This method takes a DXF entity and converts it to the corresponding
36
+ * AcDbEntity type. It first creates the entity using createEntity(),
37
+ * then processes common attributes using processCommonAttrs().
38
+ *
39
+ * @param entity - The DXF entity to convert
40
+ * @returns The converted AcDbEntity, or null if conversion fails
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * const dxfLine = { type: 'LINE', startPoint: [0, 0, 0], endPoint: [10, 10, 0] };
45
+ * const acDbLine = converter.convert(dxfLine);
46
+ * if (acDbLine) {
47
+ * console.log('Converted to:', acDbLine.type);
48
+ * }
49
+ * ```
50
+ */
51
+ AcDbEntityConverter.prototype.convert = function (entity) {
52
+ var dbEntity = this.createEntity(entity);
53
+ if (dbEntity) {
54
+ this.processCommonAttrs(entity, dbEntity);
55
+ }
56
+ return dbEntity;
57
+ };
58
+ /**
59
+ * Creates the corresponding drawing database entity from DXF format data.
60
+ *
61
+ * This method acts as a factory that routes DXF entities to their specific
62
+ * conversion methods based on the entity type. It handles all supported
63
+ * DXF entity types including geometric entities, text entities, and special entities.
64
+ *
65
+ * @param entity - Input entity data in DXF format
66
+ * @returns The converted drawing database entity, or null if the entity type is not supported
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * const dxfEntity = { type: 'CIRCLE', center: [0, 0, 0], radius: 5 };
71
+ * const acDbEntity = converter.createEntity(dxfEntity);
72
+ * ```
73
+ */
74
+ AcDbEntityConverter.prototype.createEntity = function (entity) {
75
+ if (entity.type == '3DFACE') {
76
+ return this.convertFace(entity);
77
+ }
78
+ else if (entity.type == 'ARC') {
79
+ return this.convertArc(entity);
80
+ }
81
+ else if (entity.type == 'CIRCLE') {
82
+ return this.convertCirle(entity);
83
+ }
84
+ else if (entity.type == 'DIMENSION') {
85
+ return this.convertDimension(entity);
86
+ }
87
+ else if (entity.type == 'ELLIPSE') {
88
+ return this.convertEllipse(entity);
89
+ }
90
+ else if (entity.type == 'HATCH') {
91
+ return this.convertHatch(entity);
92
+ }
93
+ else if (entity.type == 'IMAGE') {
94
+ return this.convertImage(entity);
95
+ }
96
+ else if (entity.type == 'LEADER') {
97
+ return this.convertLeader(entity);
98
+ }
99
+ else if (entity.type == 'LINE') {
100
+ return this.convertLine(entity);
101
+ }
102
+ else if (entity.type == 'MTEXT') {
103
+ return this.convertMText(entity);
104
+ }
105
+ else if (entity.type == 'POLYLINE' || entity.type == 'LWPOLYLINE') {
106
+ return this.convertPolyline(entity);
107
+ }
108
+ else if (entity.type == 'POINT') {
109
+ return this.convertPoint(entity);
110
+ }
111
+ else if (entity.type == 'RAY') {
112
+ return this.convertRay(entity);
113
+ }
114
+ else if (entity.type == 'SPLINE') {
115
+ return this.convertSpline(entity);
116
+ }
117
+ else if (entity.type == 'ACAD_TABLE') {
118
+ return this.convertTable(entity);
119
+ }
120
+ else if (entity.type == 'TEXT') {
121
+ return this.convertText(entity);
122
+ }
123
+ else if (entity.type == 'SOLID') {
124
+ return this.convertSolid(entity);
125
+ }
126
+ else if (entity.type == 'VIEWPORT') {
127
+ return this.convertViewport(entity);
128
+ }
129
+ else if (entity.type == 'WIPEOUT') {
130
+ return this.convertWipeout(entity);
131
+ }
132
+ else if (entity.type == 'XLINE') {
133
+ return this.convertXline(entity);
134
+ }
135
+ else if (entity.type == 'INSERT') {
136
+ return this.convertBlockReference(entity);
137
+ }
138
+ return null;
139
+ };
140
+ /**
141
+ * Converts a DXF 3DFACE entity to an AcDbFace.
142
+ *
143
+ * @param face - The DXF 3DFace entity to convert
144
+ * @returns The converted AcDbFace entity
145
+ */
146
+ AcDbEntityConverter.prototype.convertFace = function (face) {
147
+ var dbEntity = new AcDbFace();
148
+ face.vertices.forEach(function (vertex, index) {
149
+ return dbEntity.setVertexAt(index, vertex);
150
+ });
151
+ return dbEntity;
152
+ };
153
+ /**
154
+ * Converts a DXF arc entity to an AcDbArc.
155
+ *
156
+ * @param arc - The DXF arc entity to convert
157
+ * @returns The converted AcDbArc entity
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * const dxfArc = { type: 'ARC', center: [0, 0, 0], radius: 5, startAngle: 0, endAngle: 90 };
162
+ * const acDbArc = converter.convertArc(dxfArc);
163
+ * ```
164
+ */
165
+ AcDbEntityConverter.prototype.convertArc = function (arc) {
166
+ var dbEntity = new AcDbArc(arc.center, arc.radius, AcGeMathUtil.degToRad(arc.startAngle), AcGeMathUtil.degToRad(arc.endAngle));
167
+ return dbEntity;
168
+ };
169
+ /**
170
+ * Converts a DXF circle entity to an AcDbCircle.
171
+ *
172
+ * @param circle - The DXF circle entity to convert
173
+ * @returns The converted AcDbCircle entity
174
+ *
175
+ * @example
176
+ * ```typescript
177
+ * const dxfCircle = { type: 'CIRCLE', center: [0, 0, 0], radius: 5 };
178
+ * const acDbCircle = converter.convertCirle(dxfCircle);
179
+ * ```
180
+ */
181
+ AcDbEntityConverter.prototype.convertCirle = function (circle) {
182
+ var dbEntity = new AcDbCircle(circle.center, circle.radius);
183
+ return dbEntity;
184
+ };
185
+ /**
186
+ * Converts a DXF ellipse entity to an AcDbEllipse.
187
+ *
188
+ * @param ellipse - The DXF ellipse entity to convert
189
+ * @returns The converted AcDbEllipse entity
190
+ *
191
+ * @example
192
+ * ```typescript
193
+ * const dxfEllipse = { type: 'ELLIPSE', center: [0, 0, 0], majorAxisEndPoint: [5, 0, 0] };
194
+ * const acDbEllipse = converter.convertEllipse(dxfEllipse);
195
+ * ```
196
+ */
197
+ AcDbEntityConverter.prototype.convertEllipse = function (ellipse) {
198
+ var _a;
199
+ var majorAxis = new AcGeVector3d(ellipse.majorAxisEndPoint);
200
+ var majorAxisRadius = majorAxis.length();
201
+ var dbEntity = new AcDbEllipse(ellipse.center, (_a = ellipse.extrusionDirection) !== null && _a !== void 0 ? _a : AcGeVector3d.Z_AXIS, majorAxis, majorAxisRadius, majorAxisRadius * ellipse.axisRatio, ellipse.startAngle, ellipse.endAngle);
202
+ return dbEntity;
203
+ };
204
+ AcDbEntityConverter.prototype.convertLine = function (line) {
205
+ var start = line.startPoint;
206
+ var end = line.endPoint;
207
+ var dbEntity = new AcDbLine(new AcGePoint3d(start.x, start.y, start.z || 0), new AcGePoint3d(end.x, end.y, end.z || 0));
208
+ return dbEntity;
209
+ };
210
+ AcDbEntityConverter.prototype.convertSpline = function (spline) {
211
+ // Catch error to construct spline because it maybe one spline in one block.
212
+ // If don't catch the error, the block conversion may be interruptted.
213
+ try {
214
+ if (spline.numberOfControlPoints > 0 && spline.numberOfKnots > 0) {
215
+ return new AcDbSpline(spline.controlPoints, spline.knots, spline.weights, spline.degree, !!(spline.flag & 0x01));
216
+ }
217
+ else if (spline.numberOfFitPoints > 0) {
218
+ var fitPoints = this.numberArrayToPointArray(spline.fitPoints, spline.numberOfFitPoints);
219
+ if (fitPoints != null) {
220
+ return new AcDbSpline(fitPoints, 'Uniform', spline.degree, !!(spline.flag & 0x01));
221
+ }
222
+ }
223
+ }
224
+ catch (error) {
225
+ console.log("Failed to convert spline with error: ".concat(error));
226
+ }
227
+ return null;
228
+ };
229
+ AcDbEntityConverter.prototype.convertPoint = function (point) {
230
+ var dbEntity = new AcDbPoint();
231
+ dbEntity.position = point.position;
232
+ return dbEntity;
233
+ };
234
+ AcDbEntityConverter.prototype.convertSolid = function (solid) {
235
+ var dbEntity = new AcDbTrace();
236
+ solid.points.forEach(function (point, index) { return dbEntity.setPointAt(index, point); });
237
+ dbEntity.thickness = solid.thickness;
238
+ return dbEntity;
239
+ };
240
+ AcDbEntityConverter.prototype.convertPolyline = function (polyline) {
241
+ // Polyline flag (bit-coded; default = 0):
242
+ // https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-ABF6B778-BE20-4B49-9B58-A94E64CEFFF3
243
+ //
244
+ // 1 = This is a closed polyline (or a polygon mesh closed in the M direction)
245
+ // 2 = Curve-fit vertices have been added
246
+ // 4 = Spline-fit vertices have been added
247
+ // 8 = This is a 3D polyline
248
+ // 16 = This is a 3D polygon mesh
249
+ // 32 = The polygon mesh is closed in the N direction
250
+ // 64 = The polyline is a polyface mesh
251
+ // 128 = The linetype pattern is generated continuously around the vertices of this polyline
252
+ var dbEntity = new AcDbPolyline();
253
+ dbEntity.closed = !!(polyline.flag & 0x01);
254
+ polyline.vertices.forEach(function (vertex, index) {
255
+ dbEntity.addVertexAt(index, new AcGePoint2d(vertex.x, vertex.y), vertex.bulge, vertex.startWidth, vertex.endWidth);
256
+ });
257
+ return dbEntity;
258
+ };
259
+ AcDbEntityConverter.prototype.convertHatch = function (hatch) {
260
+ var _a;
261
+ var dbEntity = new AcDbHatch();
262
+ (_a = hatch.definitionLines) === null || _a === void 0 ? void 0 : _a.forEach(function (item) {
263
+ dbEntity.definitionLines.push({
264
+ angle: item.angle,
265
+ origin: item.base,
266
+ delta: item.offset,
267
+ dashPattern: item.numberOfDashLengths > 0 ? item.dashLengths : []
268
+ });
269
+ });
270
+ dbEntity.hatchStyle = hatch.hatchStyle;
271
+ dbEntity.patternName = hatch.patternName;
272
+ dbEntity.patternType = hatch.patternType;
273
+ dbEntity.patternAngle = hatch.patternAngle == null ? 0 : hatch.patternAngle;
274
+ dbEntity.patternScale = hatch.patternScale == null ? 0 : hatch.patternScale;
275
+ var paths = hatch.boundaryPaths;
276
+ paths.forEach(function (path) {
277
+ var flag = path.boundaryPathTypeFlag;
278
+ // Check whether it is a polyline
279
+ if (flag & 0x02) {
280
+ var polylinePath = path;
281
+ var polyline_1 = new AcGePolyline2d();
282
+ polyline_1.closed = polylinePath.isClosed;
283
+ polylinePath.vertices.forEach(function (vertex, index) {
284
+ polyline_1.addVertexAt(index, {
285
+ x: vertex.x,
286
+ y: vertex.y,
287
+ bulge: vertex.bulge
288
+ });
289
+ });
290
+ dbEntity.add(polyline_1);
291
+ }
292
+ else {
293
+ var edgePath = path;
294
+ var loop_1 = new AcGeLoop2d();
295
+ edgePath.edges.forEach(function (edge) {
296
+ if (edge.type == 1) {
297
+ var line = edge;
298
+ loop_1.add(new AcGeLine2d(line.start, line.end));
299
+ }
300
+ else if (edge.type == 2) {
301
+ var arc = edge;
302
+ loop_1.add(new AcGeCircArc2d(arc.center, arc.radius, AcGeMathUtil.degToRad(arc.startAngle || 0), AcGeMathUtil.degToRad(arc.endAngle || 0), !arc.isCCW));
303
+ }
304
+ else if (edge.type == 3) {
305
+ var ellipse = edge;
306
+ var majorAxis = new AcGeVector2d();
307
+ majorAxis.subVectors(ellipse.end, ellipse.center);
308
+ var majorAxisRadius = Math.sqrt(Math.pow(ellipse.end.x, 2) + Math.pow(ellipse.end.y, 2));
309
+ // Property name 'lengthOfMinorAxis' is really confusing.
310
+ // Actually length of minor axis means percentage of major axis length.
311
+ var minorAxisRadius = majorAxisRadius * ellipse.lengthOfMinorAxis;
312
+ var startAngle = AcGeMathUtil.degToRad(ellipse.startAngle || 0);
313
+ var endAngle = AcGeMathUtil.degToRad(ellipse.endAngle || 0);
314
+ var rotation = Math.atan2(ellipse.end.y, ellipse.end.x);
315
+ if (!ellipse.isCCW) {
316
+ // when clockwise, need to handle start/end angles
317
+ startAngle = Math.PI * 2 - startAngle;
318
+ endAngle = Math.PI * 2 - endAngle;
319
+ }
320
+ loop_1.add(new AcGeEllipseArc2d(__assign(__assign({}, ellipse.center), { z: 0 }), majorAxisRadius, minorAxisRadius, startAngle, endAngle, !ellipse.isCCW, rotation));
321
+ }
322
+ else if (edge.type == 4) {
323
+ var spline = edge;
324
+ if (spline.numberOfControlPoints > 0 && spline.numberOfKnots > 0) {
325
+ var controlPoints = spline.controlPoints.map(function (item) {
326
+ return {
327
+ x: item.x,
328
+ y: item.y,
329
+ z: 0
330
+ };
331
+ });
332
+ var hasWeights_1 = true;
333
+ var weights = spline.controlPoints.map(function (item) {
334
+ if (item.weight == null)
335
+ hasWeights_1 = false;
336
+ return item.weight || 1;
337
+ });
338
+ loop_1.add(new AcGeSpline3d(controlPoints, spline.knots, hasWeights_1 ? weights : undefined));
339
+ }
340
+ else if (spline.numberOfFitData > 0) {
341
+ var fitPoints = spline.fitDatum.map(function (item) {
342
+ return {
343
+ x: item.x,
344
+ y: item.y,
345
+ z: 0
346
+ };
347
+ });
348
+ loop_1.add(new AcGeSpline3d(fitPoints, 'Uniform'));
349
+ }
350
+ }
351
+ });
352
+ dbEntity.add(loop_1);
353
+ }
354
+ });
355
+ return dbEntity;
356
+ };
357
+ AcDbEntityConverter.prototype.convertTable = function (table) {
358
+ var dbEntity = new AcDbTable(table.name, table.rowCount, table.columnCount);
359
+ dbEntity.attachmentPoint =
360
+ table.attachmentPoint;
361
+ dbEntity.position.copy(table.startPoint);
362
+ table.columnWidthArr.forEach(function (width, index) {
363
+ return dbEntity.setColumnWidth(index, width);
364
+ });
365
+ table.rowHeightArr.forEach(function (height, index) {
366
+ return dbEntity.setRowHeight(index, height);
367
+ });
368
+ table.cells.forEach(function (cell, index) {
369
+ dbEntity.setCell(index, cell);
370
+ });
371
+ return dbEntity;
372
+ };
373
+ AcDbEntityConverter.prototype.convertText = function (text) {
374
+ var _a, _b;
375
+ var dbEntity = new AcDbText();
376
+ dbEntity.textString = text.text;
377
+ dbEntity.styleName = text.styleName;
378
+ dbEntity.height = text.textHeight;
379
+ dbEntity.position.copy(text.startPoint);
380
+ dbEntity.rotation = AcGeMathUtil.degToRad(text.rotation || 0);
381
+ dbEntity.oblique = (_a = text.obliqueAngle) !== null && _a !== void 0 ? _a : 0;
382
+ dbEntity.thickness = text.thickness;
383
+ dbEntity.horizontalMode = text.halign;
384
+ dbEntity.verticalMode = text.valign;
385
+ dbEntity.widthFactor = (_b = text.xScale) !== null && _b !== void 0 ? _b : 1;
386
+ return dbEntity;
387
+ };
388
+ AcDbEntityConverter.prototype.convertMText = function (mtext) {
389
+ var dbEntity = new AcDbMText();
390
+ dbEntity.contents = mtext.text;
391
+ if (mtext.styleName != null) {
392
+ dbEntity.styleName = mtext.styleName;
393
+ }
394
+ dbEntity.height = mtext.height;
395
+ dbEntity.width = mtext.width;
396
+ dbEntity.rotation = AcGeMathUtil.degToRad(mtext.rotation || 0);
397
+ dbEntity.location = mtext.insertionPoint;
398
+ dbEntity.attachmentPoint =
399
+ mtext.attachmentPoint;
400
+ if (mtext.direction) {
401
+ dbEntity.direction = new AcGeVector3d(mtext.direction);
402
+ }
403
+ dbEntity.drawingDirection =
404
+ mtext.drawingDirection;
405
+ return dbEntity;
406
+ };
407
+ AcDbEntityConverter.prototype.convertLeader = function (leader) {
408
+ var dbEntity = new AcDbLeader();
409
+ leader.vertices.forEach(function (point) {
410
+ dbEntity.appendVertex(point);
411
+ });
412
+ dbEntity.hasArrowHead = leader.isArrowheadEnabled;
413
+ dbEntity.hasHookLine = leader.isHooklineExists;
414
+ dbEntity.isSplined = leader.isSpline;
415
+ dbEntity.dimensionStyle = leader.styleName;
416
+ dbEntity.annoType =
417
+ leader.leaderCreationFlag;
418
+ return dbEntity;
419
+ };
420
+ AcDbEntityConverter.prototype.convertDimension = function (dimension) {
421
+ if (dimension.subclassMarker == 'AcDbAlignedDimension' ||
422
+ dimension.subclassMarker == 'AcDbRotatedDimension') {
423
+ var entity = dimension;
424
+ var dbEntity = new AcDbAlignedDimension(entity.subDefinitionPoint1, entity.subDefinitionPoint2, entity.definitionPoint);
425
+ dbEntity.rotation = AcGeMathUtil.degToRad(entity.rotationAngle || 0);
426
+ this.processDimensionCommonAttrs(dimension, dbEntity);
427
+ return dbEntity;
428
+ }
429
+ else if (dimension.subclassMarker == 'AcDb3PointAngularDimension') {
430
+ var entity = dimension;
431
+ var dbEntity = new AcDb3PointAngularDimension(entity.centerPoint, entity.subDefinitionPoint1, entity.subDefinitionPoint2, entity.definitionPoint);
432
+ this.processDimensionCommonAttrs(dimension, dbEntity);
433
+ return dbEntity;
434
+ }
435
+ else if (dimension.subclassMarker == 'AcDbOrdinateDimension') {
436
+ var entity = dimension;
437
+ var dbEntity = new AcDbOrdinateDimension(entity.subDefinitionPoint1, entity.subDefinitionPoint2);
438
+ this.processDimensionCommonAttrs(dimension, dbEntity);
439
+ return dbEntity;
440
+ }
441
+ else if (dimension.subclassMarker == 'AcDbRadialDimension') {
442
+ var entity = dimension;
443
+ var dbEntity = new AcDbRadialDimension(entity.definitionPoint, entity.centerPoint, entity.leaderLength);
444
+ this.processDimensionCommonAttrs(dimension, dbEntity);
445
+ return dbEntity;
446
+ }
447
+ else if (dimension.subclassMarker == 'AcDbDiametricDimension') {
448
+ var entity = dimension;
449
+ var dbEntity = new AcDbDiametricDimension(entity.definitionPoint, entity.centerPoint, entity.leaderLength);
450
+ this.processDimensionCommonAttrs(dimension, dbEntity);
451
+ return dbEntity;
452
+ }
453
+ return null;
454
+ };
455
+ AcDbEntityConverter.prototype.processImage = function (image, dbImage) {
456
+ dbImage.position.copy(image.position);
457
+ dbImage.brightness = image.brightness;
458
+ dbImage.contrast = image.contrast;
459
+ dbImage.fade = image.fade;
460
+ dbImage.isShownClipped = (image.flags | 0x0004) > 0;
461
+ dbImage.isImageShown = (image.flags | 0x0003) > 0;
462
+ dbImage.isImageTransparent = (image.flags | 0x0008) > 0;
463
+ dbImage.imageDefId = image.imageDefHandle;
464
+ dbImage.isClipped = image.isClipped;
465
+ image.clippingBoundaryPath.forEach(function (point) {
466
+ dbImage.clipBoundary.push(new AcGePoint2d(point));
467
+ });
468
+ // Calculate the scale factors
469
+ dbImage.width =
470
+ Math.sqrt(Math.pow(image.uPixel.x, 2) + Math.pow(image.uPixel.y, 2) + Math.pow(image.uPixel.z, 2)) * image.imageSize.x;
471
+ dbImage.height =
472
+ Math.sqrt(Math.pow(image.vPixel.x, 2) + Math.pow(image.vPixel.y, 2) + Math.pow(image.vPixel.z, 2)) * image.imageSize.y;
473
+ // Calculate the rotation angle
474
+ // Rotation is determined by the angle of the U-vector relative to the X-axis
475
+ dbImage.rotation = Math.atan2(image.uPixel.y, image.uPixel.x);
476
+ };
477
+ AcDbEntityConverter.prototype.convertImage = function (image) {
478
+ var dbImage = new AcDbRasterImage();
479
+ this.processImage(image, dbImage);
480
+ dbImage.clipBoundaryType =
481
+ image.clippingBoundaryType;
482
+ return dbImage;
483
+ };
484
+ AcDbEntityConverter.prototype.processWipeout = function (wipeout, dbWipeout) {
485
+ dbWipeout.position.copy(wipeout.position);
486
+ dbWipeout.brightness = wipeout.brightness;
487
+ dbWipeout.contrast = wipeout.contrast;
488
+ dbWipeout.fade = wipeout.fade;
489
+ dbWipeout.isShownClipped = (wipeout.displayFlag | 0x0004) > 0;
490
+ dbWipeout.isImageShown = (wipeout.displayFlag | 0x0003) > 0;
491
+ dbWipeout.isImageTransparent = (wipeout.displayFlag | 0x0008) > 0;
492
+ dbWipeout.imageDefId = wipeout.imageDefHardId;
493
+ dbWipeout.isClipped = wipeout.isClipping;
494
+ wipeout.boundary.forEach(function (point) {
495
+ dbWipeout.clipBoundary.push(new AcGePoint2d(point));
496
+ });
497
+ dbWipeout.clipBoundaryType =
498
+ wipeout.boundaryType;
499
+ // Calculate the scale factors
500
+ dbWipeout.width =
501
+ Math.sqrt(Math.pow(wipeout.uDirection.x, 2) +
502
+ Math.pow(wipeout.uDirection.y, 2) +
503
+ Math.pow(wipeout.uDirection.z, 2)) * wipeout.imageSize.x;
504
+ dbWipeout.height =
505
+ Math.sqrt(Math.pow(wipeout.vDirection.x, 2) +
506
+ Math.pow(wipeout.vDirection.y, 2) +
507
+ Math.pow(wipeout.vDirection.z, 2)) * wipeout.imageSize.y;
508
+ // Calculate the rotation angle
509
+ // Rotation is determined by the angle of the U-vector relative to the X-axis
510
+ dbWipeout.rotation = Math.atan2(wipeout.uDirection.y, wipeout.uDirection.x);
511
+ };
512
+ AcDbEntityConverter.prototype.convertWipeout = function (wipeout) {
513
+ var dbWipeout = new AcDbWipeout();
514
+ this.processWipeout(wipeout, dbWipeout);
515
+ return dbWipeout;
516
+ };
517
+ AcDbEntityConverter.prototype.convertViewport = function (viewport) {
518
+ var dbViewport = new AcDbViewport();
519
+ dbViewport.number = viewport.viewportId;
520
+ dbViewport.centerPoint.copy(viewport.viewportCenter);
521
+ dbViewport.height = viewport.height;
522
+ dbViewport.width = viewport.width;
523
+ dbViewport.viewCenter.copy(viewport.displayCenter);
524
+ dbViewport.viewHeight = viewport.viewHeight;
525
+ return dbViewport;
526
+ };
527
+ AcDbEntityConverter.prototype.convertRay = function (ray) {
528
+ var dbRay = new AcDbRay();
529
+ dbRay.basePoint.copy(ray.position);
530
+ dbRay.unitDir.copy(ray.direction);
531
+ return dbRay;
532
+ };
533
+ AcDbEntityConverter.prototype.convertXline = function (xline) {
534
+ var dbXline = new AcDbXline();
535
+ dbXline.basePoint.copy(xline.position);
536
+ dbXline.unitDir.copy(xline.direction);
537
+ return dbXline;
538
+ };
539
+ AcDbEntityConverter.prototype.convertBlockReference = function (blockReference) {
540
+ var _a;
541
+ var dbBlockReference = new AcDbBlockReference(blockReference.name);
542
+ if (blockReference.insertionPoint)
543
+ dbBlockReference.position.copy(blockReference.insertionPoint);
544
+ dbBlockReference.scaleFactors.x = blockReference.xScale || 1;
545
+ dbBlockReference.scaleFactors.y = blockReference.yScale || 1;
546
+ dbBlockReference.scaleFactors.z = blockReference.zScale || 1;
547
+ dbBlockReference.rotation =
548
+ blockReference.rotation != null
549
+ ? AcGeMathUtil.degToRad(blockReference.rotation)
550
+ : 0;
551
+ dbBlockReference.normal.copy((_a = blockReference.extrusionDirection) !== null && _a !== void 0 ? _a : { x: 0, y: 0, z: 1 });
552
+ return dbBlockReference;
553
+ };
554
+ AcDbEntityConverter.prototype.processDimensionCommonAttrs = function (entity, dbEntity) {
555
+ dbEntity.dimBlockId = entity.name;
556
+ dbEntity.textPosition.copy(entity.textPoint);
557
+ dbEntity.textRotation = entity.textRotation || 0;
558
+ if (entity.textLineSpacingFactor) {
559
+ dbEntity.textLineSpacingFactor = entity.textLineSpacingFactor;
560
+ }
561
+ if (entity.textLineSpacingStyle) {
562
+ dbEntity.textLineSpacingStyle =
563
+ entity.textLineSpacingStyle;
564
+ }
565
+ dbEntity.dimensionStyleName = entity.styleName;
566
+ dbEntity.dimensionText = entity.text || '';
567
+ dbEntity.measurement = entity.measurement;
568
+ };
569
+ /**
570
+ * Processes common attributes from a DXF entity to an AcDbEntity.
571
+ *
572
+ * This method copies common properties like layer, object ID, owner ID,
573
+ * linetype, lineweight, color, visibility, and transparency from the
574
+ * DXF entity to the corresponding AcDbEntity.
575
+ *
576
+ * @param entity - The source DXF entity
577
+ * @param dbEntity - The target AcDbEntity to populate
578
+ *
579
+ * @example
580
+ * ```typescript
581
+ * converter.processCommonAttrs(dxfEntity, acDbEntity);
582
+ * ```
583
+ */
584
+ AcDbEntityConverter.prototype.processCommonAttrs = function (entity, dbEntity) {
585
+ dbEntity.layer = entity.layer || '0';
586
+ // I found some dxf file may have entity without handle. If so, let's use objectId
587
+ // created by AcDbObject constructor instead.
588
+ if (entity.handle)
589
+ dbEntity.objectId = entity.handle;
590
+ dbEntity.ownerId = entity.ownerBlockRecordSoftId || '';
591
+ if (entity.lineType != null) {
592
+ dbEntity.lineType = entity.lineType;
593
+ }
594
+ if (entity.lineweight != null) {
595
+ dbEntity.lineWeight = entity.lineweight;
596
+ }
597
+ if (entity.lineTypeScale != null) {
598
+ dbEntity.linetypeScale = entity.lineTypeScale;
599
+ }
600
+ if (entity.color != null) {
601
+ dbEntity.color.color = entity.color;
602
+ }
603
+ if (entity.colorIndex != null) {
604
+ dbEntity.color.colorIndex = entity.colorIndex;
605
+ }
606
+ if (entity.colorName != null) {
607
+ dbEntity.color.colorName = entity.colorName;
608
+ }
609
+ if (entity.isVisible != null) {
610
+ dbEntity.visibility = entity.isVisible;
611
+ }
612
+ if (entity.transparency != null) {
613
+ dbEntity.transparency = entity.transparency;
614
+ }
615
+ };
616
+ /**
617
+ * Converts a number array to an array of 3D points.
618
+ *
619
+ * This utility method takes a flat array of numbers and converts it to
620
+ * an array of AcGePoint3dLike objects. It automatically detects whether
621
+ * the input represents 2D or 3D points based on the array length and
622
+ * number of points.
623
+ *
624
+ * @param numbers - Flat array of numbers representing point coordinates
625
+ * @param numberOfPoints - Expected number of points in the array
626
+ * @returns Array of AcGePoint3dLike objects, or undefined if the conversion fails
627
+ *
628
+ * @example
629
+ * ```typescript
630
+ * const numbers = [0, 0, 10, 10, 20, 20]; // 3 points in 2D
631
+ * const points = converter.numberArrayToPointArray(numbers, 3);
632
+ * // Returns: [{x: 0, y: 0, z: 0}, {x: 10, y: 10, z: 0}, {x: 20, y: 20, z: 0}]
633
+ * ```
634
+ */
635
+ AcDbEntityConverter.prototype.numberArrayToPointArray = function (numbers, numberOfPoints) {
636
+ var count = numbers.length;
637
+ var dimension = 0;
638
+ if (count / 2 == numberOfPoints) {
639
+ dimension = 2;
640
+ }
641
+ else if (count / 3 == numberOfPoints) {
642
+ dimension = 3;
643
+ }
644
+ if (dimension == 0)
645
+ return undefined;
646
+ var points = [];
647
+ for (var index = 0, size = count / dimension; index < size; ++index) {
648
+ points.push({
649
+ x: numbers[index * dimension],
650
+ y: numbers[index * dimension + 1],
651
+ z: dimension == 3 ? numbers[index * dimension + 2] : 0
652
+ });
653
+ }
654
+ return points;
655
+ };
656
+ return AcDbEntityConverter;
657
+ }());
658
+ export { AcDbEntityConverter };
659
+ //# sourceMappingURL=AcDbEntitiyConverter.js.map