@mlightcad/data-model 1.10.7 → 1.11.1

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 (226) hide show
  1. package/README.md +1 -1
  2. package/dist/data-model.cjs +12 -12
  3. package/lib/acis/AcDbAcisDecode.d.ts +3 -3
  4. package/lib/acis/AcDbAcisDecode.js +8 -8
  5. package/lib/acis/AcDbAcisEntities.d.ts +2 -2
  6. package/lib/acis/AcDbAcisEntities.js +2 -2
  7. package/lib/acis/AcDbAcisGeometry.d.ts +5 -5
  8. package/lib/acis/AcDbAcisGeometry.js +5 -5
  9. package/lib/acis/AcDbAcisSab.d.ts +1 -1
  10. package/lib/acis/AcDbAcisSab.js +1 -1
  11. package/lib/acis/AcDbAcisSatWireframe.d.ts +1 -1
  12. package/lib/acis/AcDbAcisSatWireframe.js +3 -3
  13. package/lib/acis/AcDbAcisWireframe.js +8 -8
  14. package/lib/acis/index.d.ts +6 -6
  15. package/lib/acis/index.d.ts.map +1 -1
  16. package/lib/acis/index.js +6 -6
  17. package/lib/acis/index.js.map +1 -1
  18. package/lib/base/AcDbHostApplicationServices.d.ts +1 -1
  19. package/lib/base/AcDbHostApplicationServices.js +3 -3
  20. package/lib/base/AcDbObject.d.ts +1 -1
  21. package/lib/base/AcDbObject.d.ts.map +1 -1
  22. package/lib/base/AcDbObject.js +9 -6
  23. package/lib/base/AcDbObject.js.map +1 -1
  24. package/lib/base/index.d.ts +2 -2
  25. package/lib/base/index.js +2 -2
  26. package/lib/converter/AcDbRegenerator.d.ts.map +1 -1
  27. package/lib/converter/AcDbRegenerator.js +40 -4
  28. package/lib/converter/AcDbRegenerator.js.map +1 -1
  29. package/lib/converter/index.d.ts +1 -1
  30. package/lib/converter/index.d.ts.map +1 -1
  31. package/lib/converter/index.js +1 -1
  32. package/lib/converter/index.js.map +1 -1
  33. package/lib/converter/worker/AcDbWorkerManager.d.ts +1 -1
  34. package/lib/converter/worker/AcDbWorkerManager.d.ts.map +1 -1
  35. package/lib/converter/worker/AcDbWorkerManager.js +1 -1
  36. package/lib/converter/worker/AcDbWorkerManager.js.map +1 -1
  37. package/lib/converter/worker/index.d.ts +1 -1
  38. package/lib/converter/worker/index.d.ts.map +1 -1
  39. package/lib/converter/worker/index.js +1 -1
  40. package/lib/converter/worker/index.js.map +1 -1
  41. package/lib/database/AcDbBlockTableRecord.d.ts +12 -7
  42. package/lib/database/AcDbBlockTableRecord.d.ts.map +1 -1
  43. package/lib/database/AcDbBlockTableRecord.js +15 -9
  44. package/lib/database/AcDbBlockTableRecord.js.map +1 -1
  45. package/lib/database/AcDbDatabase.d.ts +49 -0
  46. package/lib/database/AcDbDatabase.d.ts.map +1 -1
  47. package/lib/database/AcDbDatabase.js +304 -27
  48. package/lib/database/AcDbDatabase.js.map +1 -1
  49. package/lib/database/AcDbLayerTableRecord.d.ts +1 -1
  50. package/lib/database/AcDbLayerTableRecord.d.ts.map +1 -1
  51. package/lib/database/AcDbLayerTableRecord.js +3 -3
  52. package/lib/database/AcDbLayerTableRecord.js.map +1 -1
  53. package/lib/database/index.d.ts +1 -1
  54. package/lib/database/index.d.ts.map +1 -1
  55. package/lib/database/index.js +1 -1
  56. package/lib/database/index.js.map +1 -1
  57. package/lib/database/transaction/AcDbChangeApplier.d.ts +4 -4
  58. package/lib/database/transaction/AcDbChangeApplier.d.ts.map +1 -1
  59. package/lib/database/transaction/AcDbChangeApplier.js +6 -6
  60. package/lib/database/transaction/AcDbChangeApplier.js.map +1 -1
  61. package/lib/database/transaction/AcDbChangeRecorder.d.ts.map +1 -1
  62. package/lib/database/transaction/AcDbChangeRecorder.js +2 -2
  63. package/lib/database/transaction/AcDbChangeRecorder.js.map +1 -1
  64. package/lib/database/transaction/AcDbDatabaseChange.d.ts +1 -1
  65. package/lib/database/transaction/AcDbDatabaseChange.d.ts.map +1 -1
  66. package/lib/database/transaction/AcDbDatabaseChange.js +1 -1
  67. package/lib/database/transaction/AcDbDatabaseChange.js.map +1 -1
  68. package/lib/database/transaction/AcDbDatabaseTransactionManager.js +7 -7
  69. package/lib/database/transaction/AcDbDatabaseTransactionManager.js.map +1 -1
  70. package/lib/database/transaction/index.d.ts +2 -2
  71. package/lib/database/transaction/index.d.ts.map +1 -1
  72. package/lib/database/transaction/index.js +2 -2
  73. package/lib/database/transaction/index.js.map +1 -1
  74. package/lib/entity/AcDb3dSolid.js +3 -3
  75. package/lib/entity/AcDbArc.d.ts.map +1 -1
  76. package/lib/entity/AcDbArc.js +7 -7
  77. package/lib/entity/AcDbArc.js.map +1 -1
  78. package/lib/entity/AcDbBlockReference.d.ts +6 -0
  79. package/lib/entity/AcDbBlockReference.d.ts.map +1 -1
  80. package/lib/entity/AcDbBlockReference.js +12 -0
  81. package/lib/entity/AcDbBlockReference.js.map +1 -1
  82. package/lib/entity/AcDbCircle.d.ts.map +1 -1
  83. package/lib/entity/AcDbCircle.js +3 -3
  84. package/lib/entity/AcDbCircle.js.map +1 -1
  85. package/lib/entity/AcDbEllipse.d.ts.map +1 -1
  86. package/lib/entity/AcDbEllipse.js +3 -3
  87. package/lib/entity/AcDbEllipse.js.map +1 -1
  88. package/lib/entity/AcDbFace.js +2 -2
  89. package/lib/entity/AcDbFrame.d.ts +15 -0
  90. package/lib/entity/AcDbFrame.d.ts.map +1 -0
  91. package/lib/entity/AcDbFrame.js +36 -0
  92. package/lib/entity/AcDbFrame.js.map +1 -0
  93. package/lib/entity/AcDbLeader.js +2 -2
  94. package/lib/entity/AcDbLeader.js.map +1 -1
  95. package/lib/entity/AcDbOle2Frame.d.ts +390 -0
  96. package/lib/entity/AcDbOle2Frame.d.ts.map +1 -0
  97. package/lib/entity/AcDbOle2Frame.js +717 -0
  98. package/lib/entity/AcDbOle2Frame.js.map +1 -0
  99. package/lib/entity/AcDbOleFrame.d.ts +112 -0
  100. package/lib/entity/AcDbOleFrame.d.ts.map +1 -0
  101. package/lib/entity/AcDbOleFrame.js +198 -0
  102. package/lib/entity/AcDbOleFrame.js.map +1 -0
  103. package/lib/entity/AcDbPolyFaceMesh.js +2 -2
  104. package/lib/entity/AcDbPolyFaceMesh.js.map +1 -1
  105. package/lib/entity/AcDbPolygonMesh.js +2 -2
  106. package/lib/entity/AcDbPolygonMesh.js.map +1 -1
  107. package/lib/entity/AcDbPolyline.d.ts +2 -2
  108. package/lib/entity/AcDbPolyline.d.ts.map +1 -1
  109. package/lib/entity/AcDbPolyline.js +4 -4
  110. package/lib/entity/AcDbPolyline.js.map +1 -1
  111. package/lib/entity/AcDbProxyEntity.d.ts.map +1 -1
  112. package/lib/entity/AcDbProxyEntity.js +3 -3
  113. package/lib/entity/AcDbProxyEntity.js.map +1 -1
  114. package/lib/entity/AcDbRasterImage.d.ts +1 -1
  115. package/lib/entity/AcDbRasterImage.d.ts.map +1 -1
  116. package/lib/entity/AcDbRasterImage.js +4 -4
  117. package/lib/entity/AcDbRasterImage.js.map +1 -1
  118. package/lib/entity/AcDbRay.d.ts.map +1 -1
  119. package/lib/entity/AcDbRay.js +2 -2
  120. package/lib/entity/AcDbRay.js.map +1 -1
  121. package/lib/entity/AcDbSpline.d.ts.map +1 -1
  122. package/lib/entity/AcDbSpline.js +4 -4
  123. package/lib/entity/AcDbSpline.js.map +1 -1
  124. package/lib/entity/AcDbTrace.js +2 -2
  125. package/lib/entity/AcDbTrace.js.map +1 -1
  126. package/lib/entity/AcDbXline.d.ts.map +1 -1
  127. package/lib/entity/AcDbXline.js +2 -2
  128. package/lib/entity/AcDbXline.js.map +1 -1
  129. package/lib/entity/index.d.ts +5 -1
  130. package/lib/entity/index.d.ts.map +1 -1
  131. package/lib/entity/index.js +4 -1
  132. package/lib/entity/index.js.map +1 -1
  133. package/lib/index.d.ts +11 -9
  134. package/lib/index.d.ts.map +1 -1
  135. package/lib/index.js +8 -7
  136. package/lib/index.js.map +1 -1
  137. package/lib/ly/AcLyBoolExpr.d.ts +28 -0
  138. package/lib/ly/AcLyBoolExpr.d.ts.map +1 -0
  139. package/lib/ly/AcLyBoolExpr.js +36 -0
  140. package/lib/ly/AcLyBoolExpr.js.map +1 -0
  141. package/lib/ly/AcLyLayerFilter.d.ts +289 -0
  142. package/lib/ly/AcLyLayerFilter.d.ts.map +1 -0
  143. package/lib/ly/AcLyLayerFilter.js +509 -0
  144. package/lib/ly/AcLyLayerFilter.js.map +1 -0
  145. package/lib/ly/AcLyLayerFilterIO.d.ts +155 -0
  146. package/lib/ly/AcLyLayerFilterIO.d.ts.map +1 -0
  147. package/lib/ly/AcLyLayerFilterIO.js +517 -0
  148. package/lib/ly/AcLyLayerFilterIO.js.map +1 -0
  149. package/lib/ly/AcLyLayerFilterTree.d.ts +71 -0
  150. package/lib/ly/AcLyLayerFilterTree.d.ts.map +1 -0
  151. package/lib/ly/AcLyLayerFilterTree.js +95 -0
  152. package/lib/ly/AcLyLayerFilterTree.js.map +1 -0
  153. package/lib/ly/AcLyLayerGroup.d.ts +107 -0
  154. package/lib/ly/AcLyLayerGroup.d.ts.map +1 -0
  155. package/lib/ly/AcLyLayerGroup.js +158 -0
  156. package/lib/ly/AcLyLayerGroup.js.map +1 -0
  157. package/lib/ly/index.d.ts +8 -0
  158. package/lib/ly/index.d.ts.map +1 -0
  159. package/lib/ly/index.js +6 -0
  160. package/lib/ly/index.js.map +1 -0
  161. package/lib/misc/AcDbCodePage.d.ts +1 -1
  162. package/lib/misc/AcDbCodePage.d.ts.map +1 -1
  163. package/lib/misc/AcDbCodePage.js +1 -1
  164. package/lib/misc/AcDbCodePage.js.map +1 -1
  165. package/lib/misc/AcDbFormatter.d.ts.map +1 -1
  166. package/lib/misc/AcDbFormatter.js +3 -3
  167. package/lib/misc/AcDbFormatter.js.map +1 -1
  168. package/lib/misc/AcDbMLeaderStyleColorCodec.d.ts +2 -2
  169. package/lib/misc/AcDbMLeaderStyleColorCodec.d.ts.map +1 -1
  170. package/lib/misc/AcDbMLeaderStyleColorCodec.js +2 -2
  171. package/lib/misc/AcDbMLeaderStyleColorCodec.js.map +1 -1
  172. package/lib/misc/AcDbOleImageExtractor.d.ts +21 -0
  173. package/lib/misc/AcDbOleImageExtractor.d.ts.map +1 -0
  174. package/lib/misc/AcDbOleImageExtractor.js +659 -0
  175. package/lib/misc/AcDbOleImageExtractor.js.map +1 -0
  176. package/lib/misc/AcDbPreviewIcon.d.ts +13 -0
  177. package/lib/misc/AcDbPreviewIcon.d.ts.map +1 -0
  178. package/lib/misc/AcDbPreviewIcon.js +69 -0
  179. package/lib/misc/AcDbPreviewIcon.js.map +1 -0
  180. package/lib/misc/AcDbUnitsValue.d.ts +6 -6
  181. package/lib/misc/AcDbUnitsValue.d.ts.map +1 -1
  182. package/lib/misc/AcDbUnitsValue.js +6 -6
  183. package/lib/misc/AcDbUnitsValue.js.map +1 -1
  184. package/lib/misc/acdbDrawImageFrame.d.ts +17 -0
  185. package/lib/misc/acdbDrawImageFrame.d.ts.map +1 -0
  186. package/lib/misc/acdbDrawImageFrame.js +44 -0
  187. package/lib/misc/acdbDrawImageFrame.js.map +1 -0
  188. package/lib/misc/index.d.ts +8 -7
  189. package/lib/misc/index.d.ts.map +1 -1
  190. package/lib/misc/index.js +8 -7
  191. package/lib/misc/index.js.map +1 -1
  192. package/lib/misc/proxyGraphic/AcDbProxyGraphic.d.ts +1 -1
  193. package/lib/misc/proxyGraphic/AcDbProxyGraphic.d.ts.map +1 -1
  194. package/lib/misc/proxyGraphic/AcDbProxyGraphic.js +9 -9
  195. package/lib/misc/proxyGraphic/AcDbProxyGraphic.js.map +1 -1
  196. package/lib/misc/proxyGraphic/AcDbProxyGraphicBinaryStream.d.ts +2 -2
  197. package/lib/misc/proxyGraphic/AcDbProxyGraphicBinaryStream.d.ts.map +1 -1
  198. package/lib/misc/proxyGraphic/AcDbProxyGraphicBinaryStream.js +2 -2
  199. package/lib/misc/proxyGraphic/AcDbProxyGraphicBinaryStream.js.map +1 -1
  200. package/lib/misc/proxyGraphic/index.d.ts +2 -2
  201. package/lib/misc/proxyGraphic/index.d.ts.map +1 -1
  202. package/lib/misc/proxyGraphic/index.js +2 -2
  203. package/lib/misc/proxyGraphic/index.js.map +1 -1
  204. package/lib/object/AcDbFilter.d.ts +51 -0
  205. package/lib/object/AcDbFilter.d.ts.map +1 -0
  206. package/lib/object/AcDbFilter.js +63 -0
  207. package/lib/object/AcDbFilter.js.map +1 -0
  208. package/lib/object/AcDbIndex.d.ts +144 -0
  209. package/lib/object/AcDbIndex.d.ts.map +1 -0
  210. package/lib/object/AcDbIndex.js +146 -0
  211. package/lib/object/AcDbIndex.js.map +1 -0
  212. package/lib/object/AcDbLayerFilter.d.ts +144 -0
  213. package/lib/object/AcDbLayerFilter.d.ts.map +1 -0
  214. package/lib/object/AcDbLayerFilter.js +250 -0
  215. package/lib/object/AcDbLayerFilter.js.map +1 -0
  216. package/lib/object/AcDbLayerIndex.d.ts +165 -0
  217. package/lib/object/AcDbLayerIndex.d.ts.map +1 -0
  218. package/lib/object/AcDbLayerIndex.js +295 -0
  219. package/lib/object/AcDbLayerIndex.js.map +1 -0
  220. package/lib/object/AcDbMLeaderStyle.js +4 -4
  221. package/lib/object/AcDbMLeaderStyle.js.map +1 -1
  222. package/lib/object/index.d.ts +6 -0
  223. package/lib/object/index.d.ts.map +1 -1
  224. package/lib/object/index.js +4 -0
  225. package/lib/object/index.js.map +1 -1
  226. package/package.json +4 -4
@@ -0,0 +1,717 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ var __read = (this && this.__read) || function (o, n) {
17
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
18
+ if (!m) return o;
19
+ var i = m.call(o), r, ar = [], e;
20
+ try {
21
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
22
+ }
23
+ catch (error) { e = { error: error }; }
24
+ finally {
25
+ try {
26
+ if (r && !r.done && (m = i["return"])) m.call(i);
27
+ }
28
+ finally { if (e) throw e.error; }
29
+ }
30
+ return ar;
31
+ };
32
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
33
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
34
+ if (ar || !(i in from)) {
35
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
36
+ ar[i] = from[i];
37
+ }
38
+ }
39
+ return to.concat(ar || Array.prototype.slice.call(from));
40
+ };
41
+ import { AcGeBox3d, AcGeMatrix3d, AcGePoint3d, AcGeVector3d } from '@mlightcad/geometry-engine';
42
+ import { acdbDrawImageFrame } from '../misc/acdbDrawImageFrame';
43
+ import { acdbExtractOleImageBlob } from '../misc/AcDbOleImageExtractor';
44
+ import { AcDbOsnapMode } from '../misc/AcDbOsnapMode';
45
+ import { acdbBytesToHexString } from '../misc/proxyGraphic';
46
+ import { AcDbEntity } from './AcDbEntity';
47
+ import { acdbForEachGripIndex, acdbMovePointArrayGripAt } from './AcDbGripHelpers';
48
+ import { AcDbOleFrame } from './AcDbOleFrame';
49
+ import { acdbCollectVertexPathOsnapPoints } from './AcDbOsnapHelpers';
50
+ /**
51
+ * OLE object type stored with an {@link AcDbOle2Frame} (DXF group code 71).
52
+ *
53
+ * @see https://help.autodesk.com/cloudhelp/2018/ENU/AutoCAD-DXF/files/GUID-77747CE6-82C6-4452-97ED-4CEEB38BE960.htm
54
+ */
55
+ export var AcDbOleObjectType;
56
+ (function (AcDbOleObjectType) {
57
+ /** Linked OLE object */
58
+ AcDbOleObjectType[AcDbOleObjectType["Link"] = 1] = "Link";
59
+ /** Embedded OLE object */
60
+ AcDbOleObjectType[AcDbOleObjectType["Embedded"] = 2] = "Embedded";
61
+ /** Static OLE object */
62
+ AcDbOleObjectType[AcDbOleObjectType["Static"] = 3] = "Static";
63
+ })(AcDbOleObjectType || (AcDbOleObjectType = {}));
64
+ /**
65
+ * Tile-mode descriptor stored with an {@link AcDbOle2Frame} (DXF group code 72).
66
+ *
67
+ * Distinct from the common entity paper-space flag (group code 67).
68
+ */
69
+ export var AcDbOleTileMode;
70
+ (function (AcDbOleTileMode) {
71
+ /** Object resides in model space */
72
+ AcDbOleTileMode[AcDbOleTileMode["ModelSpace"] = 0] = "ModelSpace";
73
+ /** Object resides in paper space */
74
+ AcDbOleTileMode[AcDbOleTileMode["PaperSpace"] = 1] = "PaperSpace";
75
+ })(AcDbOleTileMode || (AcDbOleTileMode = {}));
76
+ /**
77
+ * Represents an OLE 2 frame entity in AutoCAD.
78
+ *
79
+ * {@link AcDbOle2Frame} provides a display frame for an OLE 2 object. It stores
80
+ * frame geometry (location, width, height, rotation), display settings, link
81
+ * metadata, and the embedded OLE binary payload inherited from
82
+ * {@link AcDbOleFrame}.
83
+ *
84
+ * Platform-specific MFC types such as `COleClientItem` are represented as opaque
85
+ * values in this TypeScript port.
86
+ *
87
+ * @see https://help.autodesk.com/view/OARX/2024/ENU/?guid=OARX-RefGuide-AcDbOle2Frame
88
+ * @see https://help.autodesk.com/view/OARX/2024/ENU/?guid=OARX-RefGuide-__MEMBERTYPE_Methods_AcDbOle2Frame
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * const ole = new AcDbOle2Frame()
93
+ * ole.setLocation(new AcGePoint3d(0, 10, 0))
94
+ * ole.setWcsWidth(100)
95
+ * ole.setWcsHeight(75)
96
+ * ole.userType = 'Paintbrush Picture'
97
+ * ole.oleObjectType = AcDbOleObjectType.Embedded
98
+ * ```
99
+ */
100
+ var AcDbOle2Frame = /** @class */ (function (_super) {
101
+ __extends(AcDbOle2Frame, _super);
102
+ /**
103
+ * Creates a new OLE 2 frame entity.
104
+ *
105
+ * Objects created with this constructor must receive a valid OLE payload
106
+ * through {@link setOleObject} (or host-specific client-item APIs) before they
107
+ * represent a complete OLE entity.
108
+ */
109
+ function AcDbOle2Frame() {
110
+ var _this = _super.call(this) || this;
111
+ /** Upper-left corner of the frame in WCS. */
112
+ _this._upperLeft = new AcGePoint3d();
113
+ /** Lower-right corner of the frame in WCS. */
114
+ _this._lowerRight = new AcGePoint3d();
115
+ /** Rotation angle in radians. */
116
+ _this._rotation = 0;
117
+ /** Relative scale factor applied to the frame width. */
118
+ _this._scaleWidth = 1;
119
+ /** Relative scale factor applied to the frame height. */
120
+ _this._scaleHeight = 1;
121
+ /** Whether the aspect ratio is locked. */
122
+ _this._lockAspect = false;
123
+ /** Output quality value (DXF group code 73 when present). */
124
+ _this._outputQuality = 0;
125
+ /** Automatic output quality flag. */
126
+ _this._autoOutputQuality = 0;
127
+ /** OLE object type (link / embedded / static). */
128
+ _this._oleObjectType = AcDbOleObjectType.Embedded;
129
+ /** Tile-mode descriptor. */
130
+ _this._tileMode = AcDbOleTileMode.ModelSpace;
131
+ /** User-visible OLE type description (DXF group code 3). */
132
+ _this._userType = '';
133
+ /** Linked OLE object name. */
134
+ _this._linkName = '';
135
+ /** Linked OLE object path. */
136
+ _this._linkPath = '';
137
+ /**
138
+ * Opaque host OLE client item.
139
+ *
140
+ * Mirrors ObjectARX `COleClientItem*`. There is no MFC host in the browser
141
+ * runtime, so this value is application-defined.
142
+ */
143
+ _this._oleClientItem = null;
144
+ /** Whether image extraction from the current OLE payload has been attempted. */
145
+ _this._imageResolved = false;
146
+ return _this;
147
+ }
148
+ Object.defineProperty(AcDbOle2Frame.prototype, "dxfTypeName", {
149
+ get: function () {
150
+ return 'OLE2FRAME';
151
+ },
152
+ enumerable: false,
153
+ configurable: true
154
+ });
155
+ Object.defineProperty(AcDbOle2Frame.prototype, "upperLeftCorner", {
156
+ /**
157
+ * Gets the upper-left corner of this frame in WCS.
158
+ */
159
+ get: function () {
160
+ return this._upperLeft;
161
+ },
162
+ /**
163
+ * Sets the upper-left corner of this frame in WCS.
164
+ */
165
+ set: function (value) {
166
+ this._upperLeft.copy(value);
167
+ },
168
+ enumerable: false,
169
+ configurable: true
170
+ });
171
+ Object.defineProperty(AcDbOle2Frame.prototype, "lowerRightCorner", {
172
+ /**
173
+ * Gets the lower-right corner of this frame in WCS.
174
+ */
175
+ get: function () {
176
+ return this._lowerRight;
177
+ },
178
+ /**
179
+ * Sets the lower-right corner of this frame in WCS.
180
+ */
181
+ set: function (value) {
182
+ this._lowerRight.copy(value);
183
+ },
184
+ enumerable: false,
185
+ configurable: true
186
+ });
187
+ /**
188
+ * Gets the location (upper-left corner) of this OLE frame in WCS.
189
+ *
190
+ * Mirrors ObjectARX `AcDbOle2Frame::getLocation`.
191
+ */
192
+ AcDbOle2Frame.prototype.getLocation = function (result) {
193
+ if (result) {
194
+ return result.copy(this._upperLeft);
195
+ }
196
+ return this._upperLeft.clone();
197
+ };
198
+ /**
199
+ * Sets the location (upper-left corner) of this OLE frame in WCS.
200
+ *
201
+ * The lower-right corner is translated by the same delta so the frame size is
202
+ * preserved.
203
+ *
204
+ * Mirrors ObjectARX `AcDbOle2Frame::setLocation`.
205
+ */
206
+ AcDbOle2Frame.prototype.setLocation = function (value) {
207
+ var _a;
208
+ var dx = value.x - this._upperLeft.x;
209
+ var dy = value.y - this._upperLeft.y;
210
+ var dz = ((_a = value.z) !== null && _a !== void 0 ? _a : 0) - this._upperLeft.z;
211
+ this._upperLeft.copy(value);
212
+ this._lowerRight.x += dx;
213
+ this._lowerRight.y += dy;
214
+ this._lowerRight.z += dz;
215
+ };
216
+ /**
217
+ * Gets the frame rectangle in WCS.
218
+ *
219
+ * Mirrors ObjectARX `AcDbOle2Frame::position(CRectangle3d&)`.
220
+ */
221
+ AcDbOle2Frame.prototype.position = function () {
222
+ return {
223
+ upperLeft: this._upperLeft.clone(),
224
+ upperRight: this.cornerUpperRight(),
225
+ lowerLeft: this.cornerLowerLeft(),
226
+ lowerRight: this._lowerRight.clone()
227
+ };
228
+ };
229
+ /**
230
+ * Sets the frame rectangle in WCS from the given corner points.
231
+ *
232
+ * Mirrors ObjectARX `AcDbOle2Frame::setPosition(const CRectangle3d&)`.
233
+ * Only the upper-left and lower-right corners are stored; the other two
234
+ * corners are derived.
235
+ */
236
+ AcDbOle2Frame.prototype.setPosition = function (rect) {
237
+ this._upperLeft.copy(rect.upperLeft);
238
+ this._lowerRight.copy(rect.lowerRight);
239
+ };
240
+ /**
241
+ * Gets the frame width in WCS units.
242
+ *
243
+ * Mirrors ObjectARX `AcDbOle2Frame::wcsWidth`.
244
+ */
245
+ AcDbOle2Frame.prototype.wcsWidth = function () {
246
+ return Math.abs(this._lowerRight.x - this._upperLeft.x);
247
+ };
248
+ /**
249
+ * Sets the frame width in WCS units, keeping the upper-left corner fixed.
250
+ *
251
+ * Mirrors ObjectARX `AcDbOle2Frame::setWcsWidth`.
252
+ */
253
+ AcDbOle2Frame.prototype.setWcsWidth = function (value) {
254
+ var sign = this._lowerRight.x >= this._upperLeft.x ? 1 : -1;
255
+ this._lowerRight.x = this._upperLeft.x + sign * Math.abs(value);
256
+ if (this._lockAspect) {
257
+ this.syncHeightFromAspect();
258
+ }
259
+ };
260
+ /**
261
+ * Gets the frame height in WCS units.
262
+ *
263
+ * Mirrors ObjectARX `AcDbOle2Frame::wcsHeight`.
264
+ */
265
+ AcDbOle2Frame.prototype.wcsHeight = function () {
266
+ return Math.abs(this._upperLeft.y - this._lowerRight.y);
267
+ };
268
+ /**
269
+ * Sets the frame height in WCS units, keeping the upper-left corner fixed.
270
+ *
271
+ * Mirrors ObjectARX `AcDbOle2Frame::setWcsHeight`.
272
+ */
273
+ AcDbOle2Frame.prototype.setWcsHeight = function (value) {
274
+ var sign = this._upperLeft.y >= this._lowerRight.y ? 1 : -1;
275
+ this._lowerRight.y = this._upperLeft.y - sign * Math.abs(value);
276
+ if (this._lockAspect) {
277
+ this.syncWidthFromAspect();
278
+ }
279
+ };
280
+ /**
281
+ * Gets the relative width scale factor.
282
+ *
283
+ * Mirrors ObjectARX `AcDbOle2Frame::scaleWidth`.
284
+ */
285
+ AcDbOle2Frame.prototype.scaleWidth = function () {
286
+ return this._scaleWidth;
287
+ };
288
+ /**
289
+ * Sets the relative width scale factor.
290
+ *
291
+ * Mirrors ObjectARX `AcDbOle2Frame::setScaleWidth`.
292
+ */
293
+ AcDbOle2Frame.prototype.setScaleWidth = function (value) {
294
+ this._scaleWidth = value;
295
+ };
296
+ /**
297
+ * Gets the relative height scale factor.
298
+ *
299
+ * Mirrors ObjectARX `AcDbOle2Frame::scaleHeight`.
300
+ */
301
+ AcDbOle2Frame.prototype.scaleHeight = function () {
302
+ return this._scaleHeight;
303
+ };
304
+ /**
305
+ * Sets the relative height scale factor.
306
+ *
307
+ * Mirrors ObjectARX `AcDbOle2Frame::setScaleHeight`.
308
+ */
309
+ AcDbOle2Frame.prototype.setScaleHeight = function (value) {
310
+ this._scaleHeight = value;
311
+ };
312
+ /**
313
+ * Gets the rotation angle of this frame in radians.
314
+ *
315
+ * Mirrors ObjectARX `AcDbOle2Frame::rotation`.
316
+ */
317
+ AcDbOle2Frame.prototype.rotation = function () {
318
+ return this._rotation;
319
+ };
320
+ /**
321
+ * Sets the rotation angle of this frame in radians.
322
+ *
323
+ * Mirrors ObjectARX `AcDbOle2Frame::setRotation`.
324
+ */
325
+ AcDbOle2Frame.prototype.setRotation = function (value) {
326
+ this._rotation = value;
327
+ };
328
+ /**
329
+ * Returns whether the frame aspect ratio is locked.
330
+ *
331
+ * Mirrors ObjectARX `AcDbOle2Frame::lockAspect`.
332
+ */
333
+ AcDbOle2Frame.prototype.lockAspect = function () {
334
+ return this._lockAspect;
335
+ };
336
+ /**
337
+ * Sets whether the frame aspect ratio is locked.
338
+ *
339
+ * Mirrors ObjectARX `AcDbOle2Frame::setLockAspect`.
340
+ */
341
+ AcDbOle2Frame.prototype.setLockAspect = function (value) {
342
+ this._lockAspect = !!value;
343
+ };
344
+ /**
345
+ * Gets the output quality value.
346
+ *
347
+ * Mirrors ObjectARX `AcDbOle2Frame::outputQuality`.
348
+ */
349
+ AcDbOle2Frame.prototype.outputQuality = function () {
350
+ return this._outputQuality;
351
+ };
352
+ /**
353
+ * Sets the output quality value.
354
+ *
355
+ * Mirrors ObjectARX `AcDbOle2Frame::setOutputQuality`.
356
+ */
357
+ AcDbOle2Frame.prototype.setOutputQuality = function (value) {
358
+ this._outputQuality = value & 0xff;
359
+ };
360
+ /**
361
+ * Gets the automatic output quality flag.
362
+ *
363
+ * Mirrors ObjectARX `AcDbOle2Frame::autoOutputQuality`.
364
+ */
365
+ AcDbOle2Frame.prototype.autoOutputQuality = function () {
366
+ return this._autoOutputQuality;
367
+ };
368
+ /**
369
+ * Sets the automatic output quality flag.
370
+ *
371
+ * Mirrors ObjectARX `AcDbOle2Frame::setAutoOutputQuality`.
372
+ */
373
+ AcDbOle2Frame.prototype.setAutoOutputQuality = function (value) {
374
+ this._autoOutputQuality = value & 0xff;
375
+ };
376
+ /**
377
+ * Gets the OLE object type (link / embedded / static).
378
+ *
379
+ * Mirrors ObjectARX `AcDbOle2Frame::getType`.
380
+ */
381
+ AcDbOle2Frame.prototype.getType = function () {
382
+ return this._oleObjectType;
383
+ };
384
+ /**
385
+ * Sets the OLE object type (link / embedded / static).
386
+ */
387
+ AcDbOle2Frame.prototype.setType = function (value) {
388
+ this._oleObjectType = value;
389
+ };
390
+ Object.defineProperty(AcDbOle2Frame.prototype, "oleObjectType", {
391
+ /**
392
+ * Gets the OLE object type (link / embedded / static).
393
+ *
394
+ * Prefer {@link getType} when matching ObjectARX naming.
395
+ */
396
+ get: function () {
397
+ return this._oleObjectType;
398
+ },
399
+ set: function (value) {
400
+ this._oleObjectType = value;
401
+ },
402
+ enumerable: false,
403
+ configurable: true
404
+ });
405
+ Object.defineProperty(AcDbOle2Frame.prototype, "tileMode", {
406
+ /**
407
+ * Gets the tile-mode descriptor for this frame.
408
+ */
409
+ get: function () {
410
+ return this._tileMode;
411
+ },
412
+ set: function (value) {
413
+ this._tileMode = value;
414
+ },
415
+ enumerable: false,
416
+ configurable: true
417
+ });
418
+ /**
419
+ * Gets the user-visible OLE type description.
420
+ *
421
+ * Mirrors ObjectARX `AcDbOle2Frame::getUserType`. Corresponds to DXF group
422
+ * code **3**.
423
+ */
424
+ AcDbOle2Frame.prototype.getUserType = function () {
425
+ return this._userType;
426
+ };
427
+ /**
428
+ * Sets the user-visible OLE type description.
429
+ */
430
+ AcDbOle2Frame.prototype.setUserType = function (value) {
431
+ this._userType = value;
432
+ };
433
+ Object.defineProperty(AcDbOle2Frame.prototype, "userType", {
434
+ /**
435
+ * Gets the user-visible OLE type description.
436
+ *
437
+ * Prefer {@link getUserType} when matching ObjectARX naming.
438
+ */
439
+ get: function () {
440
+ return this._userType;
441
+ },
442
+ set: function (value) {
443
+ this._userType = value;
444
+ },
445
+ enumerable: false,
446
+ configurable: true
447
+ });
448
+ /**
449
+ * Gets the linked OLE object name.
450
+ *
451
+ * Mirrors ObjectARX `AcDbOle2Frame::getLinkName`.
452
+ */
453
+ AcDbOle2Frame.prototype.getLinkName = function () {
454
+ return this._linkName;
455
+ };
456
+ /**
457
+ * Sets the linked OLE object name.
458
+ */
459
+ AcDbOle2Frame.prototype.setLinkName = function (value) {
460
+ this._linkName = value;
461
+ };
462
+ /**
463
+ * Gets the linked OLE object path.
464
+ *
465
+ * Mirrors ObjectARX `AcDbOle2Frame::getLinkPath`.
466
+ */
467
+ AcDbOle2Frame.prototype.getLinkPath = function () {
468
+ return this._linkPath;
469
+ };
470
+ /**
471
+ * Sets the linked OLE object path.
472
+ */
473
+ AcDbOle2Frame.prototype.setLinkPath = function (value) {
474
+ this._linkPath = value;
475
+ };
476
+ /**
477
+ * Returns the opaque host OLE client item associated with this frame.
478
+ *
479
+ * Mirrors ObjectARX `AcDbOle2Frame::getOleClientItem`. There is no MFC
480
+ * `COleClientItem` in the browser runtime; the value is application-defined.
481
+ */
482
+ AcDbOle2Frame.prototype.getOleClientItem = function () {
483
+ return this._oleClientItem;
484
+ };
485
+ /**
486
+ * Associates an opaque host OLE client item with this frame.
487
+ *
488
+ * Mirrors ObjectARX `AcDbOle2Frame::setOleClientItem`.
489
+ */
490
+ AcDbOle2Frame.prototype.setOleClientItem = function (value) {
491
+ this._oleClientItem = value !== null && value !== void 0 ? value : null;
492
+ };
493
+ Object.defineProperty(AcDbOle2Frame.prototype, "geometricExtents", {
494
+ /**
495
+ * @inheritdoc
496
+ */
497
+ get: function () {
498
+ return new AcGeBox3d().setFromPoints(this.boundaryPath());
499
+ },
500
+ enumerable: false,
501
+ configurable: true
502
+ });
503
+ /**
504
+ * @inheritdoc
505
+ */
506
+ AcDbOle2Frame.prototype.subGetGripPoints = function () {
507
+ return this.boundaryPath().slice(0, 4);
508
+ };
509
+ /** @inheritdoc */
510
+ AcDbOle2Frame.prototype.subMoveGripPointsAt = function (indices, offset) {
511
+ var _this = this;
512
+ var corners = this.boundaryPath().slice(0, 4);
513
+ acdbMovePointArrayGripAt(indices, offset, corners);
514
+ acdbForEachGripIndex(indices, function (index) {
515
+ if (index === 0) {
516
+ _this._upperLeft.copy(corners[0]);
517
+ }
518
+ else if (index === 2) {
519
+ _this._lowerRight.copy(corners[2]);
520
+ }
521
+ else if (index === 1) {
522
+ _this._upperLeft.y = corners[1].y;
523
+ _this._lowerRight.x = corners[1].x;
524
+ _this._upperLeft.z = corners[1].z;
525
+ _this._lowerRight.z = corners[1].z;
526
+ }
527
+ else if (index === 3) {
528
+ _this._upperLeft.x = corners[3].x;
529
+ _this._lowerRight.y = corners[3].y;
530
+ _this._upperLeft.z = corners[3].z;
531
+ _this._lowerRight.z = corners[3].z;
532
+ }
533
+ });
534
+ return this;
535
+ };
536
+ /**
537
+ * Gets object snap points for this OLE frame.
538
+ */
539
+ AcDbOle2Frame.prototype.subGetOsnapPoints = function (osnapMode, pickPoint, _lastPoint, snapPoints) {
540
+ if (osnapMode === AcDbOsnapMode.Insertion) {
541
+ snapPoints.push(this._upperLeft.clone());
542
+ return;
543
+ }
544
+ var vertices = this.boundaryPath().slice(0, 4);
545
+ if (osnapMode === AcDbOsnapMode.EndPoint) {
546
+ snapPoints.push.apply(snapPoints, __spreadArray([], __read(vertices), false));
547
+ return;
548
+ }
549
+ acdbCollectVertexPathOsnapPoints(vertices, true, osnapMode, pickPoint, snapPoints);
550
+ };
551
+ /**
552
+ * Transforms this OLE frame by the specified matrix.
553
+ */
554
+ AcDbOle2Frame.prototype.transformBy = function (matrix) {
555
+ var signedWidth = this._lowerRight.x - this._upperLeft.x;
556
+ var signedHeight = this._upperLeft.y - this._lowerRight.y;
557
+ var cos = Math.cos(this._rotation);
558
+ var sin = Math.sin(this._rotation);
559
+ var origin = this._upperLeft.clone();
560
+ var uPoint = origin
561
+ .clone()
562
+ .add(new AcGeVector3d(signedWidth * cos, signedWidth * sin, 0));
563
+ var vPoint = origin
564
+ .clone()
565
+ .add(new AcGeVector3d(signedHeight * sin, -signedHeight * cos, 0));
566
+ origin.applyMatrix4(matrix);
567
+ uPoint.applyMatrix4(matrix);
568
+ vPoint.applyMatrix4(matrix);
569
+ var transformedU = new AcGeVector3d().subVectors(uPoint, origin);
570
+ var transformedV = new AcGeVector3d().subVectors(vPoint, origin);
571
+ this._upperLeft.copy(origin);
572
+ this._rotation = Math.atan2(transformedU.y, transformedU.x);
573
+ this._lowerRight.set(origin.x + transformedU.length(), origin.y - transformedV.length(), origin.z);
574
+ return this;
575
+ };
576
+ Object.defineProperty(AcDbOle2Frame.prototype, "image", {
577
+ /**
578
+ * Gets the image blob extracted from the embedded OLE object, when the
579
+ * payload contains a recognizable bitmap / PNG / JPEG presentation.
580
+ *
581
+ * Extraction is performed lazily on first access and cached until the OLE
582
+ * binary payload changes.
583
+ */
584
+ get: function () {
585
+ return this.resolveImage();
586
+ },
587
+ enumerable: false,
588
+ configurable: true
589
+ });
590
+ /**
591
+ * Draws the embedded OLE picture when an image can be extracted from the
592
+ * OLE binary payload; otherwise draws a pickable rectangular frame
593
+ * (transparent fill + outline).
594
+ */
595
+ AcDbOle2Frame.prototype.subWorldDraw = function (renderer) {
596
+ var image = this.resolveImage();
597
+ var points = this.imageBoundaryPath();
598
+ if (image) {
599
+ return renderer.image(image, {
600
+ boundary: points,
601
+ roation: this._rotation
602
+ });
603
+ }
604
+ return acdbDrawImageFrame(renderer, this.boundaryPath());
605
+ };
606
+ /** @inheritdoc */
607
+ AcDbOle2Frame.prototype.onOleObjectChanged = function () {
608
+ this._image = undefined;
609
+ this._imageResolved = false;
610
+ };
611
+ AcDbOle2Frame.prototype.resolveImage = function () {
612
+ if (this._imageResolved) {
613
+ return this._image;
614
+ }
615
+ this._imageResolved = true;
616
+ this._image = acdbExtractOleImageBlob(this.oleObjectData);
617
+ return this._image;
618
+ };
619
+ /**
620
+ * Image quad in the same corner order as {@link AcDbRasterImage}:
621
+ * lower-left, lower-right, upper-right, upper-left, then close.
622
+ */
623
+ AcDbOle2Frame.prototype.imageBoundaryPath = function () {
624
+ var frame = this.boundaryPath();
625
+ var points = [frame[3], frame[2], frame[1], frame[0]];
626
+ points.push(points[0].clone());
627
+ return points;
628
+ };
629
+ /**
630
+ * Writes DXF fields for this OLE 2 frame.
631
+ *
632
+ * Emits the `AcDbOle2Frame` subclass marker and Autodesk OLE2FRAME group
633
+ * codes. Entity-level fields come from {@link AcDbEntity.dxfOutFields};
634
+ * {@link AcDbOleFrame} fields are skipped because OLE2FRAME uses its own
635
+ * layout.
636
+ *
637
+ * @param filer - DXF output writer.
638
+ * @returns The instance (for chaining).
639
+ * @see https://help.autodesk.com/cloudhelp/2018/ENU/AutoCAD-DXF/files/GUID-77747CE6-82C6-4452-97ED-4CEEB38BE960.htm
640
+ */
641
+ AcDbOle2Frame.prototype.dxfOutFields = function (filer) {
642
+ AcDbEntity.prototype.dxfOutFields.call(this, filer);
643
+ filer.writeSubclassMarker('AcDbOle2Frame');
644
+ filer.writeInt16(70, this.oleVersion);
645
+ if (this._userType) {
646
+ filer.writeString(3, this._userType);
647
+ }
648
+ filer.writePoint3d(10, this._upperLeft);
649
+ filer.writePoint3d(11, this._lowerRight);
650
+ filer.writeInt16(71, this._oleObjectType);
651
+ filer.writeInt16(72, this._tileMode);
652
+ if (this._outputQuality) {
653
+ filer.writeInt16(73, this._outputQuality);
654
+ }
655
+ var oleObject = this.getOleObject();
656
+ if (oleObject === null || oleObject === void 0 ? void 0 : oleObject.length) {
657
+ filer.writeInt32(90, oleObject.length);
658
+ var index = 0;
659
+ while (index < oleObject.length) {
660
+ var chunk = oleObject.subarray(index, index + 127);
661
+ filer.writeString(310, acdbBytesToHexString(chunk));
662
+ index += 127;
663
+ }
664
+ }
665
+ filer.writeString(1, 'OLE');
666
+ return this;
667
+ };
668
+ AcDbOle2Frame.prototype.cornerUpperRight = function () {
669
+ return new AcGePoint3d(this._lowerRight.x, this._upperLeft.y, this._upperLeft.z);
670
+ };
671
+ AcDbOle2Frame.prototype.cornerLowerLeft = function () {
672
+ return new AcGePoint3d(this._upperLeft.x, this._lowerRight.y, this._lowerRight.z);
673
+ };
674
+ AcDbOle2Frame.prototype.boundaryPath = function () {
675
+ var points = [
676
+ this._upperLeft.clone(),
677
+ this.cornerUpperRight(),
678
+ this._lowerRight.clone(),
679
+ this.cornerLowerLeft()
680
+ ];
681
+ if (this._rotation !== 0) {
682
+ var origin_1 = this._upperLeft;
683
+ for (var index = 1; index < points.length; index++) {
684
+ points[index]
685
+ .sub(origin_1)
686
+ .applyMatrix4(new AcGeMatrix3d().makeRotationZ(this._rotation));
687
+ points[index].add(origin_1);
688
+ }
689
+ }
690
+ // Closed path for line rendering
691
+ points.push(points[0].clone());
692
+ return points;
693
+ };
694
+ AcDbOle2Frame.prototype.syncHeightFromAspect = function () {
695
+ var width = this.wcsWidth();
696
+ if (width === 0 || this._scaleWidth === 0)
697
+ return;
698
+ var aspect = this._scaleHeight / this._scaleWidth;
699
+ var height = width * aspect;
700
+ var sign = this._upperLeft.y >= this._lowerRight.y ? 1 : -1;
701
+ this._lowerRight.y = this._upperLeft.y - sign * Math.abs(height);
702
+ };
703
+ AcDbOle2Frame.prototype.syncWidthFromAspect = function () {
704
+ var height = this.wcsHeight();
705
+ if (height === 0 || this._scaleHeight === 0)
706
+ return;
707
+ var aspect = this._scaleWidth / this._scaleHeight;
708
+ var width = height * aspect;
709
+ var sign = this._lowerRight.x >= this._upperLeft.x ? 1 : -1;
710
+ this._lowerRight.x = this._upperLeft.x + sign * Math.abs(width);
711
+ };
712
+ /** The entity type name */
713
+ AcDbOle2Frame.typeName = 'Ole2Frame';
714
+ return AcDbOle2Frame;
715
+ }(AcDbOleFrame));
716
+ export { AcDbOle2Frame };
717
+ //# sourceMappingURL=AcDbOle2Frame.js.map