@mlightcad/data-model 1.3.0 → 1.3.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 (324) hide show
  1. package/package.json +4 -4
  2. package/dist/data-model.cjs +0 -5
  3. package/dist/data-model.js +0 -25305
  4. package/dist/dxf-parser-worker.js +0 -1669
  5. package/lib/base/AcDbHostApplicationServices.d.ts +0 -96
  6. package/lib/base/AcDbHostApplicationServices.d.ts.map +0 -1
  7. package/lib/base/AcDbHostApplicationServices.js +0 -118
  8. package/lib/base/AcDbHostApplicationServices.js.map +0 -1
  9. package/lib/base/AcDbObject.d.ts +0 -205
  10. package/lib/base/AcDbObject.d.ts.map +0 -1
  11. package/lib/base/AcDbObject.js +0 -236
  12. package/lib/base/AcDbObject.js.map +0 -1
  13. package/lib/base/index.d.ts +0 -3
  14. package/lib/base/index.d.ts.map +0 -1
  15. package/lib/base/index.js +0 -3
  16. package/lib/base/index.js.map +0 -1
  17. package/lib/converter/AcDbBatchProcessing.d.ts +0 -146
  18. package/lib/converter/AcDbBatchProcessing.d.ts.map +0 -1
  19. package/lib/converter/AcDbBatchProcessing.js +0 -272
  20. package/lib/converter/AcDbBatchProcessing.js.map +0 -1
  21. package/lib/converter/AcDbDxfConverter.d.ts +0 -272
  22. package/lib/converter/AcDbDxfConverter.d.ts.map +0 -1
  23. package/lib/converter/AcDbDxfConverter.js +0 -872
  24. package/lib/converter/AcDbDxfConverter.js.map +0 -1
  25. package/lib/converter/AcDbDxfParser.d.ts +0 -23
  26. package/lib/converter/AcDbDxfParser.d.ts.map +0 -1
  27. package/lib/converter/AcDbDxfParser.js +0 -83
  28. package/lib/converter/AcDbDxfParser.js.map +0 -1
  29. package/lib/converter/AcDbEntitiyConverter.d.ts +0 -159
  30. package/lib/converter/AcDbEntitiyConverter.d.ts.map +0 -1
  31. package/lib/converter/AcDbEntitiyConverter.js +0 -659
  32. package/lib/converter/AcDbEntitiyConverter.js.map +0 -1
  33. package/lib/converter/AcDbObjectConverter.d.ts +0 -61
  34. package/lib/converter/AcDbObjectConverter.d.ts.map +0 -1
  35. package/lib/converter/AcDbObjectConverter.js +0 -91
  36. package/lib/converter/AcDbObjectConverter.js.map +0 -1
  37. package/lib/converter/index.d.ts +0 -4
  38. package/lib/converter/index.d.ts.map +0 -1
  39. package/lib/converter/index.js +0 -4
  40. package/lib/converter/index.js.map +0 -1
  41. package/lib/converter/worker/AcDbBaseWorker.d.ts +0 -36
  42. package/lib/converter/worker/AcDbBaseWorker.d.ts.map +0 -1
  43. package/lib/converter/worker/AcDbBaseWorker.js +0 -93
  44. package/lib/converter/worker/AcDbBaseWorker.js.map +0 -1
  45. package/lib/converter/worker/AcDbDxfParserWorker.d.ts +0 -11
  46. package/lib/converter/worker/AcDbDxfParserWorker.d.ts.map +0 -1
  47. package/lib/converter/worker/AcDbDxfParserWorker.js +0 -75
  48. package/lib/converter/worker/AcDbDxfParserWorker.js.map +0 -1
  49. package/lib/converter/worker/AcDbWorkerManager.d.ts +0 -107
  50. package/lib/converter/worker/AcDbWorkerManager.d.ts.map +0 -1
  51. package/lib/converter/worker/AcDbWorkerManager.js +0 -360
  52. package/lib/converter/worker/AcDbWorkerManager.js.map +0 -1
  53. package/lib/converter/worker/index.d.ts +0 -3
  54. package/lib/converter/worker/index.d.ts.map +0 -1
  55. package/lib/converter/worker/index.js +0 -3
  56. package/lib/converter/worker/index.js.map +0 -1
  57. package/lib/database/AcDbBlockTable.d.ts +0 -56
  58. package/lib/database/AcDbBlockTable.d.ts.map +0 -1
  59. package/lib/database/AcDbBlockTable.js +0 -98
  60. package/lib/database/AcDbBlockTable.js.map +0 -1
  61. package/lib/database/AcDbBlockTableRecord.d.ts +0 -185
  62. package/lib/database/AcDbBlockTableRecord.d.ts.map +0 -1
  63. package/lib/database/AcDbBlockTableRecord.js +0 -261
  64. package/lib/database/AcDbBlockTableRecord.js.map +0 -1
  65. package/lib/database/AcDbDatabase.d.ts +0 -575
  66. package/lib/database/AcDbDatabase.d.ts.map +0 -1
  67. package/lib/database/AcDbDatabase.js +0 -833
  68. package/lib/database/AcDbDatabase.js.map +0 -1
  69. package/lib/database/AcDbDatabaseConverter.d.ts +0 -292
  70. package/lib/database/AcDbDatabaseConverter.d.ts.map +0 -1
  71. package/lib/database/AcDbDatabaseConverter.js +0 -447
  72. package/lib/database/AcDbDatabaseConverter.js.map +0 -1
  73. package/lib/database/AcDbDatabaseConverterManager.d.ts +0 -141
  74. package/lib/database/AcDbDatabaseConverterManager.d.ts.map +0 -1
  75. package/lib/database/AcDbDatabaseConverterManager.js +0 -173
  76. package/lib/database/AcDbDatabaseConverterManager.js.map +0 -1
  77. package/lib/database/AcDbDimStyleTable.d.ts +0 -31
  78. package/lib/database/AcDbDimStyleTable.d.ts.map +0 -1
  79. package/lib/database/AcDbDimStyleTable.js +0 -49
  80. package/lib/database/AcDbDimStyleTable.js.map +0 -1
  81. package/lib/database/AcDbDimStyleTableRecord.d.ts +0 -797
  82. package/lib/database/AcDbDimStyleTableRecord.d.ts.map +0 -1
  83. package/lib/database/AcDbDimStyleTableRecord.js +0 -1294
  84. package/lib/database/AcDbDimStyleTableRecord.js.map +0 -1
  85. package/lib/database/AcDbDwgVersion.d.ts +0 -32
  86. package/lib/database/AcDbDwgVersion.d.ts.map +0 -1
  87. package/lib/database/AcDbDwgVersion.js +0 -76
  88. package/lib/database/AcDbDwgVersion.js.map +0 -1
  89. package/lib/database/AcDbLayerTable.d.ts +0 -51
  90. package/lib/database/AcDbLayerTable.d.ts.map +0 -1
  91. package/lib/database/AcDbLayerTable.js +0 -92
  92. package/lib/database/AcDbLayerTable.js.map +0 -1
  93. package/lib/database/AcDbLayerTableRecord.d.ts +0 -278
  94. package/lib/database/AcDbLayerTableRecord.d.ts.map +0 -1
  95. package/lib/database/AcDbLayerTableRecord.js +0 -397
  96. package/lib/database/AcDbLayerTableRecord.js.map +0 -1
  97. package/lib/database/AcDbLinetypeTable.d.ts +0 -30
  98. package/lib/database/AcDbLinetypeTable.d.ts.map +0 -1
  99. package/lib/database/AcDbLinetypeTable.js +0 -48
  100. package/lib/database/AcDbLinetypeTable.js.map +0 -1
  101. package/lib/database/AcDbLinetypeTableRecord.d.ts +0 -79
  102. package/lib/database/AcDbLinetypeTableRecord.d.ts.map +0 -1
  103. package/lib/database/AcDbLinetypeTableRecord.js +0 -129
  104. package/lib/database/AcDbLinetypeTableRecord.js.map +0 -1
  105. package/lib/database/AcDbSymbolTable.d.ts +0 -199
  106. package/lib/database/AcDbSymbolTable.d.ts.map +0 -1
  107. package/lib/database/AcDbSymbolTable.js +0 -264
  108. package/lib/database/AcDbSymbolTable.js.map +0 -1
  109. package/lib/database/AcDbSymbolTableRecord.d.ts +0 -61
  110. package/lib/database/AcDbSymbolTableRecord.d.ts.map +0 -1
  111. package/lib/database/AcDbSymbolTableRecord.js +0 -82
  112. package/lib/database/AcDbSymbolTableRecord.js.map +0 -1
  113. package/lib/database/AcDbTextStyleTable.d.ts +0 -48
  114. package/lib/database/AcDbTextStyleTable.d.ts.map +0 -1
  115. package/lib/database/AcDbTextStyleTable.js +0 -112
  116. package/lib/database/AcDbTextStyleTable.js.map +0 -1
  117. package/lib/database/AcDbTextStyleTableRecord.d.ts +0 -179
  118. package/lib/database/AcDbTextStyleTableRecord.d.ts.map +0 -1
  119. package/lib/database/AcDbTextStyleTableRecord.js +0 -276
  120. package/lib/database/AcDbTextStyleTableRecord.js.map +0 -1
  121. package/lib/database/AcDbViewportTable.d.ts +0 -31
  122. package/lib/database/AcDbViewportTable.d.ts.map +0 -1
  123. package/lib/database/AcDbViewportTable.js +0 -49
  124. package/lib/database/AcDbViewportTable.js.map +0 -1
  125. package/lib/database/AcDbViewportTableRecord.d.ts +0 -154
  126. package/lib/database/AcDbViewportTableRecord.d.ts.map +0 -1
  127. package/lib/database/AcDbViewportTableRecord.js +0 -318
  128. package/lib/database/AcDbViewportTableRecord.js.map +0 -1
  129. package/lib/database/index.d.ts +0 -19
  130. package/lib/database/index.d.ts.map +0 -1
  131. package/lib/database/index.js +0 -19
  132. package/lib/database/index.js.map +0 -1
  133. package/lib/entity/AcDbArc.d.ts +0 -254
  134. package/lib/entity/AcDbArc.d.ts.map +0 -1
  135. package/lib/entity/AcDbArc.js +0 -340
  136. package/lib/entity/AcDbArc.js.map +0 -1
  137. package/lib/entity/AcDbBlockReference.d.ts +0 -190
  138. package/lib/entity/AcDbBlockReference.d.ts.map +0 -1
  139. package/lib/entity/AcDbBlockReference.js +0 -302
  140. package/lib/entity/AcDbBlockReference.js.map +0 -1
  141. package/lib/entity/AcDbCircle.d.ts +0 -186
  142. package/lib/entity/AcDbCircle.d.ts.map +0 -1
  143. package/lib/entity/AcDbCircle.js +0 -249
  144. package/lib/entity/AcDbCircle.js.map +0 -1
  145. package/lib/entity/AcDbCurve.d.ts +0 -42
  146. package/lib/entity/AcDbCurve.d.ts.map +0 -1
  147. package/lib/entity/AcDbCurve.js +0 -44
  148. package/lib/entity/AcDbCurve.js.map +0 -1
  149. package/lib/entity/AcDbEllipse.d.ts +0 -207
  150. package/lib/entity/AcDbEllipse.d.ts.map +0 -1
  151. package/lib/entity/AcDbEllipse.js +0 -272
  152. package/lib/entity/AcDbEllipse.js.map +0 -1
  153. package/lib/entity/AcDbEntity.d.ts +0 -385
  154. package/lib/entity/AcDbEntity.d.ts.map +0 -1
  155. package/lib/entity/AcDbEntity.js +0 -561
  156. package/lib/entity/AcDbEntity.js.map +0 -1
  157. package/lib/entity/AcDbFace.d.ts +0 -151
  158. package/lib/entity/AcDbFace.d.ts.map +0 -1
  159. package/lib/entity/AcDbFace.js +0 -224
  160. package/lib/entity/AcDbFace.js.map +0 -1
  161. package/lib/entity/AcDbHatch.d.ts +0 -174
  162. package/lib/entity/AcDbHatch.d.ts.map +0 -1
  163. package/lib/entity/AcDbHatch.js +0 -250
  164. package/lib/entity/AcDbHatch.js.map +0 -1
  165. package/lib/entity/AcDbLeader.d.ts +0 -243
  166. package/lib/entity/AcDbLeader.d.ts.map +0 -1
  167. package/lib/entity/AcDbLeader.js +0 -358
  168. package/lib/entity/AcDbLeader.js.map +0 -1
  169. package/lib/entity/AcDbLine.d.ts +0 -198
  170. package/lib/entity/AcDbLine.d.ts.map +0 -1
  171. package/lib/entity/AcDbLine.js +0 -300
  172. package/lib/entity/AcDbLine.js.map +0 -1
  173. package/lib/entity/AcDbMText.d.ts +0 -248
  174. package/lib/entity/AcDbMText.d.ts.map +0 -1
  175. package/lib/entity/AcDbMText.js +0 -414
  176. package/lib/entity/AcDbMText.js.map +0 -1
  177. package/lib/entity/AcDbPoint.d.ts +0 -113
  178. package/lib/entity/AcDbPoint.d.ts.map +0 -1
  179. package/lib/entity/AcDbPoint.js +0 -155
  180. package/lib/entity/AcDbPoint.js.map +0 -1
  181. package/lib/entity/AcDbPolyline.d.ts +0 -221
  182. package/lib/entity/AcDbPolyline.d.ts.map +0 -1
  183. package/lib/entity/AcDbPolyline.js +0 -301
  184. package/lib/entity/AcDbPolyline.js.map +0 -1
  185. package/lib/entity/AcDbRasterImage.d.ts +0 -216
  186. package/lib/entity/AcDbRasterImage.d.ts.map +0 -1
  187. package/lib/entity/AcDbRasterImage.js +0 -451
  188. package/lib/entity/AcDbRasterImage.js.map +0 -1
  189. package/lib/entity/AcDbRay.d.ts +0 -150
  190. package/lib/entity/AcDbRay.d.ts.map +0 -1
  191. package/lib/entity/AcDbRay.js +0 -208
  192. package/lib/entity/AcDbRay.js.map +0 -1
  193. package/lib/entity/AcDbSpline.d.ts +0 -135
  194. package/lib/entity/AcDbSpline.d.ts.map +0 -1
  195. package/lib/entity/AcDbSpline.js +0 -142
  196. package/lib/entity/AcDbSpline.js.map +0 -1
  197. package/lib/entity/AcDbTable.d.ts +0 -260
  198. package/lib/entity/AcDbTable.d.ts.map +0 -1
  199. package/lib/entity/AcDbTable.js +0 -452
  200. package/lib/entity/AcDbTable.js.map +0 -1
  201. package/lib/entity/AcDbText.d.ts +0 -388
  202. package/lib/entity/AcDbText.d.ts.map +0 -1
  203. package/lib/entity/AcDbText.js +0 -523
  204. package/lib/entity/AcDbText.js.map +0 -1
  205. package/lib/entity/AcDbTrace.d.ts +0 -193
  206. package/lib/entity/AcDbTrace.d.ts.map +0 -1
  207. package/lib/entity/AcDbTrace.js +0 -271
  208. package/lib/entity/AcDbTrace.js.map +0 -1
  209. package/lib/entity/AcDbViewport.d.ts +0 -173
  210. package/lib/entity/AcDbViewport.d.ts.map +0 -1
  211. package/lib/entity/AcDbViewport.js +0 -295
  212. package/lib/entity/AcDbViewport.js.map +0 -1
  213. package/lib/entity/AcDbWipeout.d.ts +0 -39
  214. package/lib/entity/AcDbWipeout.d.ts.map +0 -1
  215. package/lib/entity/AcDbWipeout.js +0 -70
  216. package/lib/entity/AcDbWipeout.js.map +0 -1
  217. package/lib/entity/AcDbXline.d.ts +0 -151
  218. package/lib/entity/AcDbXline.d.ts.map +0 -1
  219. package/lib/entity/AcDbXline.js +0 -209
  220. package/lib/entity/AcDbXline.js.map +0 -1
  221. package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts +0 -92
  222. package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts.map +0 -1
  223. package/lib/entity/dimension/AcDb3PointAngularDimension.js +0 -157
  224. package/lib/entity/dimension/AcDb3PointAngularDimension.js.map +0 -1
  225. package/lib/entity/dimension/AcDbAlignedDimension.d.ts +0 -220
  226. package/lib/entity/dimension/AcDbAlignedDimension.d.ts.map +0 -1
  227. package/lib/entity/dimension/AcDbAlignedDimension.js +0 -341
  228. package/lib/entity/dimension/AcDbAlignedDimension.js.map +0 -1
  229. package/lib/entity/dimension/AcDbArcDimension.d.ts +0 -94
  230. package/lib/entity/dimension/AcDbArcDimension.d.ts.map +0 -1
  231. package/lib/entity/dimension/AcDbArcDimension.js +0 -159
  232. package/lib/entity/dimension/AcDbArcDimension.js.map +0 -1
  233. package/lib/entity/dimension/AcDbDiametricDimension.d.ts +0 -145
  234. package/lib/entity/dimension/AcDbDiametricDimension.d.ts.map +0 -1
  235. package/lib/entity/dimension/AcDbDiametricDimension.js +0 -275
  236. package/lib/entity/dimension/AcDbDiametricDimension.js.map +0 -1
  237. package/lib/entity/dimension/AcDbDimension.d.ts +0 -257
  238. package/lib/entity/dimension/AcDbDimension.d.ts.map +0 -1
  239. package/lib/entity/dimension/AcDbDimension.js +0 -466
  240. package/lib/entity/dimension/AcDbDimension.js.map +0 -1
  241. package/lib/entity/dimension/AcDbOrdinateDimension.d.ts +0 -78
  242. package/lib/entity/dimension/AcDbOrdinateDimension.d.ts.map +0 -1
  243. package/lib/entity/dimension/AcDbOrdinateDimension.js +0 -133
  244. package/lib/entity/dimension/AcDbOrdinateDimension.js.map +0 -1
  245. package/lib/entity/dimension/AcDbRadialDimension.d.ts +0 -214
  246. package/lib/entity/dimension/AcDbRadialDimension.d.ts.map +0 -1
  247. package/lib/entity/dimension/AcDbRadialDimension.js +0 -288
  248. package/lib/entity/dimension/AcDbRadialDimension.js.map +0 -1
  249. package/lib/entity/dimension/index.d.ts +0 -8
  250. package/lib/entity/dimension/index.d.ts.map +0 -1
  251. package/lib/entity/dimension/index.js +0 -8
  252. package/lib/entity/dimension/index.js.map +0 -1
  253. package/lib/entity/index.d.ts +0 -24
  254. package/lib/entity/index.d.ts.map +0 -1
  255. package/lib/entity/index.js +0 -24
  256. package/lib/entity/index.js.map +0 -1
  257. package/lib/index.d.ts +0 -10
  258. package/lib/index.d.ts.map +0 -1
  259. package/lib/index.js +0 -10
  260. package/lib/index.js.map +0 -1
  261. package/lib/misc/AcDbAngleUnits.d.ts +0 -20
  262. package/lib/misc/AcDbAngleUnits.d.ts.map +0 -1
  263. package/lib/misc/AcDbAngleUnits.js +0 -21
  264. package/lib/misc/AcDbAngleUnits.js.map +0 -1
  265. package/lib/misc/AcDbCodePage.d.ts +0 -50
  266. package/lib/misc/AcDbCodePage.d.ts.map +0 -1
  267. package/lib/misc/AcDbCodePage.js +0 -100
  268. package/lib/misc/AcDbCodePage.js.map +0 -1
  269. package/lib/misc/AcDbConstants.d.ts +0 -24
  270. package/lib/misc/AcDbConstants.d.ts.map +0 -1
  271. package/lib/misc/AcDbConstants.js +0 -24
  272. package/lib/misc/AcDbConstants.js.map +0 -1
  273. package/lib/misc/AcDbDimArrowType.d.ts +0 -89
  274. package/lib/misc/AcDbDimArrowType.d.ts.map +0 -1
  275. package/lib/misc/AcDbDimArrowType.js +0 -90
  276. package/lib/misc/AcDbDimArrowType.js.map +0 -1
  277. package/lib/misc/AcDbObjectIterator.d.ts +0 -55
  278. package/lib/misc/AcDbObjectIterator.d.ts.map +0 -1
  279. package/lib/misc/AcDbObjectIterator.js +0 -67
  280. package/lib/misc/AcDbObjectIterator.js.map +0 -1
  281. package/lib/misc/AcDbOsnapMode.d.ts +0 -51
  282. package/lib/misc/AcDbOsnapMode.d.ts.map +0 -1
  283. package/lib/misc/AcDbOsnapMode.js +0 -52
  284. package/lib/misc/AcDbOsnapMode.js.map +0 -1
  285. package/lib/misc/AcDbRenderingCache.d.ts +0 -141
  286. package/lib/misc/AcDbRenderingCache.d.ts.map +0 -1
  287. package/lib/misc/AcDbRenderingCache.js +0 -239
  288. package/lib/misc/AcDbRenderingCache.js.map +0 -1
  289. package/lib/misc/AcDbUnitsValue.d.ts +0 -101
  290. package/lib/misc/AcDbUnitsValue.d.ts.map +0 -1
  291. package/lib/misc/AcDbUnitsValue.js +0 -121
  292. package/lib/misc/AcDbUnitsValue.js.map +0 -1
  293. package/lib/misc/index.d.ts +0 -9
  294. package/lib/misc/index.d.ts.map +0 -1
  295. package/lib/misc/index.js +0 -9
  296. package/lib/misc/index.js.map +0 -1
  297. package/lib/object/AcDbDictionary.d.ts +0 -178
  298. package/lib/object/AcDbDictionary.d.ts.map +0 -1
  299. package/lib/object/AcDbDictionary.js +0 -264
  300. package/lib/object/AcDbDictionary.js.map +0 -1
  301. package/lib/object/AcDbRasterImageDef.d.ts +0 -54
  302. package/lib/object/AcDbRasterImageDef.d.ts.map +0 -1
  303. package/lib/object/AcDbRasterImageDef.js +0 -82
  304. package/lib/object/AcDbRasterImageDef.js.map +0 -1
  305. package/lib/object/index.d.ts +0 -4
  306. package/lib/object/index.d.ts.map +0 -1
  307. package/lib/object/index.js +0 -4
  308. package/lib/object/index.js.map +0 -1
  309. package/lib/object/layout/AcDbLayout.d.ts +0 -190
  310. package/lib/object/layout/AcDbLayout.d.ts.map +0 -1
  311. package/lib/object/layout/AcDbLayout.js +0 -253
  312. package/lib/object/layout/AcDbLayout.js.map +0 -1
  313. package/lib/object/layout/AcDbLayoutDictionary.d.ts +0 -47
  314. package/lib/object/layout/AcDbLayoutDictionary.d.ts.map +0 -1
  315. package/lib/object/layout/AcDbLayoutDictionary.js +0 -122
  316. package/lib/object/layout/AcDbLayoutDictionary.js.map +0 -1
  317. package/lib/object/layout/AcDbLayoutManager.d.ts +0 -188
  318. package/lib/object/layout/AcDbLayoutManager.d.ts.map +0 -1
  319. package/lib/object/layout/AcDbLayoutManager.js +0 -245
  320. package/lib/object/layout/AcDbLayoutManager.js.map +0 -1
  321. package/lib/object/layout/index.d.ts +0 -4
  322. package/lib/object/layout/index.d.ts.map +0 -1
  323. package/lib/object/layout/index.js +0 -4
  324. package/lib/object/layout/index.js.map +0 -1
@@ -1,659 +0,0 @@
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