@mlightcad/data-model 1.9.1 → 1.9.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.
@@ -0,0 +1,244 @@
1
+ import { AcGeBox3d, AcGeMatrix3d, AcGePoint3d } from '@mlightcad/geometry-engine';
2
+ import { AcGiEntity, AcGiRenderer } from '@mlightcad/graphic-interface';
3
+ import { AcDbDxfFiler } from '../base/AcDbDxfFiler';
4
+ import { AcDbEntity } from './AcDbEntity';
5
+ /**
6
+ * Represents a proxy entity for custom objects not natively supported by the
7
+ * host application.
8
+ *
9
+ * When AutoCAD loads a drawing that contains custom ObjectARX entities whose
10
+ * class definitions are unavailable, those objects are stored as
11
+ * `ACAD_PROXY_ENTITY` records. Each proxy entity carries metadata about the
12
+ * original class and a binary **proxy graphic** stream that encodes drawable
13
+ * primitives (lines, arcs, text, and so on).
14
+ *
15
+ * {@link subWorldDraw} decodes that stream through {@link AcDbProxyGraphic}
16
+ * and renders the contained primitives via {@link AcGiRenderer}, allowing
17
+ * viewers such as cad-viewer to display third-party objects without the
18
+ * original ARX module.
19
+ *
20
+ * @see https://help.autodesk.com/view/OARX/2024/ENU/?guid=OARX-RefGuide-AcDbProxyEntity
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * const proxy = new AcDbProxyEntity()
25
+ * proxy.originalDxfName = 'AECC_TIN_SURFACE'
26
+ * proxy.setProxyGraphic(binaryData)
27
+ * const drawable = proxy.subWorldDraw(renderer)
28
+ * ```
29
+ */
30
+ export declare class AcDbProxyEntity extends AcDbEntity {
31
+ /**
32
+ * The runtime entity type name used by {@link AcDbEntity.type}.
33
+ *
34
+ * Always `'ProxyEntity'`.
35
+ */
36
+ static typeName: string;
37
+ /**
38
+ * Gets the DXF entity type name written to and read from drawing files.
39
+ *
40
+ * @returns The literal `'ACAD_PROXY_ENTITY'`.
41
+ */
42
+ get dxfTypeName(): string;
43
+ /**
44
+ * Original DXF entity name of the proxied class.
45
+ *
46
+ * Stored in DXF group code **1**. Example: `'AECC_TIN_SURFACE'`.
47
+ */
48
+ private _originalDxfName;
49
+ /**
50
+ * Original ObjectARX class name of the proxied object.
51
+ *
52
+ * Stored in DXF group code **3** when present.
53
+ */
54
+ private _originalClassName;
55
+ /**
56
+ * Registered application name that created the proxied object.
57
+ *
58
+ * Stored in DXF extended-data group code **1001** when present.
59
+ */
60
+ private _applicationName;
61
+ /**
62
+ * Proxy-entity class identifier assigned by the creating application.
63
+ *
64
+ * Stored in DXF group code **90**.
65
+ */
66
+ private _proxyEntityClassId;
67
+ /**
68
+ * Graphics metafile type flag describing how proxy graphics were captured.
69
+ *
70
+ * Stored in DXF group code **91**. Also referred to as the object drawing
71
+ * format in some DXF parsers.
72
+ */
73
+ private _graphicsMetafileType;
74
+ /**
75
+ * Raw binary proxy-graphics payload.
76
+ *
77
+ * Length is stored in DXF group code **160**; the bytes themselves are
78
+ * serialized as hexadecimal strings in group code **310** chunks.
79
+ */
80
+ private _proxyGraphic?;
81
+ /**
82
+ * Optional entity-origin anchor points associated with the proxy entity.
83
+ *
84
+ * Count is stored in DXF group code **92**; each point uses group code **10**.
85
+ */
86
+ private _entityOrigins;
87
+ /**
88
+ * Gets the original DXF name of the proxied entity class.
89
+ *
90
+ * Mirrors the ObjectARX original-class DXF name and corresponds to DXF
91
+ * group code **1**.
92
+ *
93
+ * @returns The proxied class DXF name, or an empty string when unset.
94
+ */
95
+ get originalDxfName(): string;
96
+ /**
97
+ * Sets the original DXF name of the proxied entity class.
98
+ *
99
+ * @param value - Proxied class DXF name (DXF group code **1**).
100
+ */
101
+ set originalDxfName(value: string);
102
+ /**
103
+ * Gets the original ObjectARX class name of the proxied object.
104
+ *
105
+ * Corresponds to DXF group code **3** when exported.
106
+ *
107
+ * @returns The ObjectARX class name, or an empty string when unset.
108
+ */
109
+ get originalClassName(): string;
110
+ /**
111
+ * Sets the original ObjectARX class name of the proxied object.
112
+ *
113
+ * @param value - ObjectARX class name (DXF group code **3**).
114
+ */
115
+ set originalClassName(value: string);
116
+ /**
117
+ * Gets the registered application name that created the proxied object.
118
+ *
119
+ * Corresponds to DXF extended-data group code **1001** when exported.
120
+ *
121
+ * @returns The creating application name, or an empty string when unset.
122
+ */
123
+ get applicationName(): string;
124
+ /**
125
+ * Sets the registered application name that created the proxied object.
126
+ *
127
+ * @param value - Application name (DXF group code **1001**).
128
+ */
129
+ set applicationName(value: string);
130
+ /**
131
+ * Gets the proxy-entity class identifier.
132
+ *
133
+ * Corresponds to DXF group code **90**.
134
+ *
135
+ * @returns The class identifier assigned by the creating application.
136
+ */
137
+ get proxyEntityClassId(): number;
138
+ /**
139
+ * Sets the proxy-entity class identifier.
140
+ *
141
+ * @param value - Class identifier (DXF group code **90**).
142
+ */
143
+ set proxyEntityClassId(value: number);
144
+ /**
145
+ * Gets the graphics metafile type flag.
146
+ *
147
+ * Corresponds to DXF group code **91**.
148
+ *
149
+ * @returns The metafile / object-drawing-format flag.
150
+ */
151
+ get graphicsMetafileType(): number;
152
+ /**
153
+ * Sets the graphics metafile type flag.
154
+ *
155
+ * @param value - Metafile type (DXF group code **91**).
156
+ */
157
+ set graphicsMetafileType(value: number);
158
+ /**
159
+ * Gets the decoded proxy-graphics binary payload.
160
+ *
161
+ * @returns A copy of the stored bytes, or `undefined` when no graphics are
162
+ * attached.
163
+ */
164
+ get proxyGraphic(): Uint8Array | undefined;
165
+ /**
166
+ * Sets the proxy-graphics binary payload.
167
+ *
168
+ * The supplied buffer is copied so subsequent mutations of the caller's array
169
+ * do not affect this entity.
170
+ *
171
+ * @param data - Raw proxy-graphic bytes, or `null`/`undefined` to clear.
172
+ */
173
+ setProxyGraphic(data?: Uint8Array | null): void;
174
+ /**
175
+ * Gets the entity-origin anchor points stored on this proxy entity.
176
+ *
177
+ * @returns A read-only view of the origin points. Mutate through
178
+ * {@link setEntityOrigins}.
179
+ */
180
+ get entityOrigins(): AcGePoint3d[];
181
+ /**
182
+ * Replaces the entity-origin anchor points stored on this proxy entity.
183
+ *
184
+ * Each input point is cloned into an {@link AcGePoint3d} instance.
185
+ *
186
+ * @param origins - New origin points (DXF group codes **92** / **10**).
187
+ */
188
+ setEntityOrigins(origins: AcGePoint3d[]): void;
189
+ /**
190
+ * Gets the geometric extents of this proxy entity.
191
+ *
192
+ * When the proxy-graphic stream contains an {@link AcDbProxyGraphicType.Extents}
193
+ * chunk, the returned box is built from its minimum and maximum corners.
194
+ * Otherwise an empty {@link AcGeBox3d} is returned.
195
+ *
196
+ * @returns The axis-aligned bounding box derived from proxy graphics.
197
+ */
198
+ get geometricExtents(): AcGeBox3d;
199
+ /**
200
+ * Transforms this proxy entity by the specified matrix.
201
+ *
202
+ * Only {@link entityOrigins} are modified. The proxy-graphic byte stream is
203
+ * left unchanged because transforms are encoded as {@link AcDbProxyGraphicType.PushMatrix}
204
+ * / {@link AcDbProxyGraphicType.PopMatrix} commands inside the stream and
205
+ * applied at render time by {@link AcDbProxyGraphic}.
206
+ *
207
+ * @param matrix - Transformation matrix to apply to entity origins.
208
+ * @returns This entity for chaining.
209
+ */
210
+ transformBy(matrix: AcGeMatrix3d): this;
211
+ /**
212
+ * Draws proxy graphics by decoding the binary stream and emitting primitives
213
+ * through the renderer.
214
+ *
215
+ * This is the primary world-space draw entry point for proxy entities. It
216
+ * delegates to {@link AcDbProxyGraphic.worldDraw} using the entity database
217
+ * and layer as rendering context.
218
+ *
219
+ * @param renderer - Target graphics renderer.
220
+ * @returns A grouped {@link AcGiEntity} when geometry was emitted, otherwise
221
+ * `undefined`.
222
+ */
223
+ subWorldDraw(renderer: AcGiRenderer): AcGiEntity | undefined;
224
+ /**
225
+ * Writes DXF subclass fields for this proxy entity.
226
+ *
227
+ * Emits the `AcDbProxyEntity` subclass marker followed by group codes **1**,
228
+ * **3**, **1001**, **90**, **91**, **92**, **10**, **160**, and **310** as
229
+ * appropriate.
230
+ *
231
+ * @param filer - DXF output filer.
232
+ * @returns This entity for chaining.
233
+ */
234
+ dxfOutFields(filer: AcDbDxfFiler): this;
235
+ /**
236
+ * Loads proxy-graphic bytes from DXF group codes **160** and **310**.
237
+ *
238
+ * @param length - Expected byte length from group code **160**. When provided
239
+ * and positive, the result is truncated to this length.
240
+ * @param hexChunks - One or more hexadecimal strings from group code **310**.
241
+ */
242
+ loadProxyGraphicFromDxf(length?: number, hexChunks?: string[]): void;
243
+ }
244
+ //# sourceMappingURL=AcDbProxyEntity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcDbProxyEntity.d.ts","sourceRoot":"","sources":["../../src/entity/AcDbProxyEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACjF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAMnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,eAAgB,SAAQ,UAAU;IAC7C;;;;OAIG;IACH,OAAgB,QAAQ,EAAE,MAAM,CAAgB;IAEhD;;;;OAIG;IACH,IAAa,WAAW,WAEvB;IAED;;;;OAIG;IACH,OAAO,CAAC,gBAAgB,CAAK;IAE7B;;;;OAIG;IACH,OAAO,CAAC,kBAAkB,CAAK;IAE/B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB,CAAK;IAE7B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB,CAAI;IAE/B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB,CAAI;IAEjC;;;;;OAKG;IACH,OAAO,CAAC,aAAa,CAAC,CAAY;IAElC;;;;OAIG;IACH,OAAO,CAAC,cAAc,CAAoB;IAE1C;;;;;;;OAOG;IACH,IAAI,eAAe,IASQ,MAAM,CAPhC;IAED;;;;OAIG;IACH,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAEhC;IAED;;;;;;OAMG;IACH,IAAI,iBAAiB,IASQ,MAAM,CAPlC;IAED;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAElC;IAED;;;;;;OAMG;IACH,IAAI,eAAe,IASQ,MAAM,CAPhC;IAED;;;;OAIG;IACH,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAEhC;IAED;;;;;;OAMG;IACH,IAAI,kBAAkB,IASQ,MAAM,CAPnC;IAED;;;;OAIG;IACH,IAAI,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAEnC;IAED;;;;;;OAMG;IACH,IAAI,oBAAoB,IASQ,MAAM,CAPrC;IAED;;;;OAIG;IACH,IAAI,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAErC;IAED;;;;;OAKG;IACH,IAAI,YAAY,2BAEf;IAED;;;;;;;OAOG;IACH,eAAe,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI;IAIxC;;;;;OAKG;IACH,IAAI,aAAa,kBAEhB;IAED;;;;;;OAMG;IACH,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE;IAMvC;;;;;;;;OAQG;IACH,IAAI,gBAAgB,IAAI,SAAS,CAchC;IAED;;;;;;;;;;OAUG;IACH,WAAW,CAAC,MAAM,EAAE,YAAY;IAKhC;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,UAAU,GAAG,SAAS;IAa5D;;;;;;;;;OASG;IACM,YAAY,CAAC,KAAK,EAAE,YAAY;IAiCzC;;;;;;OAMG;IACH,uBAAuB,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE;CAM9D"}
@@ -0,0 +1,410 @@
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, AcGePoint3d } from '@mlightcad/geometry-engine';
42
+ import { AcDbProxyGraphic, bytesToHexString, loadAcDbProxyGraphicFromDxf } from '../misc/proxyGraphic';
43
+ import { AcDbEntity } from './AcDbEntity';
44
+ /**
45
+ * Represents a proxy entity for custom objects not natively supported by the
46
+ * host application.
47
+ *
48
+ * When AutoCAD loads a drawing that contains custom ObjectARX entities whose
49
+ * class definitions are unavailable, those objects are stored as
50
+ * `ACAD_PROXY_ENTITY` records. Each proxy entity carries metadata about the
51
+ * original class and a binary **proxy graphic** stream that encodes drawable
52
+ * primitives (lines, arcs, text, and so on).
53
+ *
54
+ * {@link subWorldDraw} decodes that stream through {@link AcDbProxyGraphic}
55
+ * and renders the contained primitives via {@link AcGiRenderer}, allowing
56
+ * viewers such as cad-viewer to display third-party objects without the
57
+ * original ARX module.
58
+ *
59
+ * @see https://help.autodesk.com/view/OARX/2024/ENU/?guid=OARX-RefGuide-AcDbProxyEntity
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * const proxy = new AcDbProxyEntity()
64
+ * proxy.originalDxfName = 'AECC_TIN_SURFACE'
65
+ * proxy.setProxyGraphic(binaryData)
66
+ * const drawable = proxy.subWorldDraw(renderer)
67
+ * ```
68
+ */
69
+ var AcDbProxyEntity = /** @class */ (function (_super) {
70
+ __extends(AcDbProxyEntity, _super);
71
+ function AcDbProxyEntity() {
72
+ var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
73
+ /**
74
+ * Original DXF entity name of the proxied class.
75
+ *
76
+ * Stored in DXF group code **1**. Example: `'AECC_TIN_SURFACE'`.
77
+ */
78
+ _this._originalDxfName = '';
79
+ /**
80
+ * Original ObjectARX class name of the proxied object.
81
+ *
82
+ * Stored in DXF group code **3** when present.
83
+ */
84
+ _this._originalClassName = '';
85
+ /**
86
+ * Registered application name that created the proxied object.
87
+ *
88
+ * Stored in DXF extended-data group code **1001** when present.
89
+ */
90
+ _this._applicationName = '';
91
+ /**
92
+ * Proxy-entity class identifier assigned by the creating application.
93
+ *
94
+ * Stored in DXF group code **90**.
95
+ */
96
+ _this._proxyEntityClassId = 0;
97
+ /**
98
+ * Graphics metafile type flag describing how proxy graphics were captured.
99
+ *
100
+ * Stored in DXF group code **91**. Also referred to as the object drawing
101
+ * format in some DXF parsers.
102
+ */
103
+ _this._graphicsMetafileType = 0;
104
+ /**
105
+ * Optional entity-origin anchor points associated with the proxy entity.
106
+ *
107
+ * Count is stored in DXF group code **92**; each point uses group code **10**.
108
+ */
109
+ _this._entityOrigins = [];
110
+ return _this;
111
+ }
112
+ Object.defineProperty(AcDbProxyEntity.prototype, "dxfTypeName", {
113
+ /**
114
+ * Gets the DXF entity type name written to and read from drawing files.
115
+ *
116
+ * @returns The literal `'ACAD_PROXY_ENTITY'`.
117
+ */
118
+ get: function () {
119
+ return 'ACAD_PROXY_ENTITY';
120
+ },
121
+ enumerable: false,
122
+ configurable: true
123
+ });
124
+ Object.defineProperty(AcDbProxyEntity.prototype, "originalDxfName", {
125
+ /**
126
+ * Gets the original DXF name of the proxied entity class.
127
+ *
128
+ * Mirrors the ObjectARX original-class DXF name and corresponds to DXF
129
+ * group code **1**.
130
+ *
131
+ * @returns The proxied class DXF name, or an empty string when unset.
132
+ */
133
+ get: function () {
134
+ return this._originalDxfName;
135
+ },
136
+ /**
137
+ * Sets the original DXF name of the proxied entity class.
138
+ *
139
+ * @param value - Proxied class DXF name (DXF group code **1**).
140
+ */
141
+ set: function (value) {
142
+ this._originalDxfName = value;
143
+ },
144
+ enumerable: false,
145
+ configurable: true
146
+ });
147
+ Object.defineProperty(AcDbProxyEntity.prototype, "originalClassName", {
148
+ /**
149
+ * Gets the original ObjectARX class name of the proxied object.
150
+ *
151
+ * Corresponds to DXF group code **3** when exported.
152
+ *
153
+ * @returns The ObjectARX class name, or an empty string when unset.
154
+ */
155
+ get: function () {
156
+ return this._originalClassName;
157
+ },
158
+ /**
159
+ * Sets the original ObjectARX class name of the proxied object.
160
+ *
161
+ * @param value - ObjectARX class name (DXF group code **3**).
162
+ */
163
+ set: function (value) {
164
+ this._originalClassName = value;
165
+ },
166
+ enumerable: false,
167
+ configurable: true
168
+ });
169
+ Object.defineProperty(AcDbProxyEntity.prototype, "applicationName", {
170
+ /**
171
+ * Gets the registered application name that created the proxied object.
172
+ *
173
+ * Corresponds to DXF extended-data group code **1001** when exported.
174
+ *
175
+ * @returns The creating application name, or an empty string when unset.
176
+ */
177
+ get: function () {
178
+ return this._applicationName;
179
+ },
180
+ /**
181
+ * Sets the registered application name that created the proxied object.
182
+ *
183
+ * @param value - Application name (DXF group code **1001**).
184
+ */
185
+ set: function (value) {
186
+ this._applicationName = value;
187
+ },
188
+ enumerable: false,
189
+ configurable: true
190
+ });
191
+ Object.defineProperty(AcDbProxyEntity.prototype, "proxyEntityClassId", {
192
+ /**
193
+ * Gets the proxy-entity class identifier.
194
+ *
195
+ * Corresponds to DXF group code **90**.
196
+ *
197
+ * @returns The class identifier assigned by the creating application.
198
+ */
199
+ get: function () {
200
+ return this._proxyEntityClassId;
201
+ },
202
+ /**
203
+ * Sets the proxy-entity class identifier.
204
+ *
205
+ * @param value - Class identifier (DXF group code **90**).
206
+ */
207
+ set: function (value) {
208
+ this._proxyEntityClassId = value;
209
+ },
210
+ enumerable: false,
211
+ configurable: true
212
+ });
213
+ Object.defineProperty(AcDbProxyEntity.prototype, "graphicsMetafileType", {
214
+ /**
215
+ * Gets the graphics metafile type flag.
216
+ *
217
+ * Corresponds to DXF group code **91**.
218
+ *
219
+ * @returns The metafile / object-drawing-format flag.
220
+ */
221
+ get: function () {
222
+ return this._graphicsMetafileType;
223
+ },
224
+ /**
225
+ * Sets the graphics metafile type flag.
226
+ *
227
+ * @param value - Metafile type (DXF group code **91**).
228
+ */
229
+ set: function (value) {
230
+ this._graphicsMetafileType = value;
231
+ },
232
+ enumerable: false,
233
+ configurable: true
234
+ });
235
+ Object.defineProperty(AcDbProxyEntity.prototype, "proxyGraphic", {
236
+ /**
237
+ * Gets the decoded proxy-graphics binary payload.
238
+ *
239
+ * @returns A copy of the stored bytes, or `undefined` when no graphics are
240
+ * attached.
241
+ */
242
+ get: function () {
243
+ return this._proxyGraphic;
244
+ },
245
+ enumerable: false,
246
+ configurable: true
247
+ });
248
+ /**
249
+ * Sets the proxy-graphics binary payload.
250
+ *
251
+ * The supplied buffer is copied so subsequent mutations of the caller's array
252
+ * do not affect this entity.
253
+ *
254
+ * @param data - Raw proxy-graphic bytes, or `null`/`undefined` to clear.
255
+ */
256
+ AcDbProxyEntity.prototype.setProxyGraphic = function (data) {
257
+ this._proxyGraphic = data ? new Uint8Array(data) : undefined;
258
+ };
259
+ Object.defineProperty(AcDbProxyEntity.prototype, "entityOrigins", {
260
+ /**
261
+ * Gets the entity-origin anchor points stored on this proxy entity.
262
+ *
263
+ * @returns A read-only view of the origin points. Mutate through
264
+ * {@link setEntityOrigins}.
265
+ */
266
+ get: function () {
267
+ return this._entityOrigins;
268
+ },
269
+ enumerable: false,
270
+ configurable: true
271
+ });
272
+ /**
273
+ * Replaces the entity-origin anchor points stored on this proxy entity.
274
+ *
275
+ * Each input point is cloned into an {@link AcGePoint3d} instance.
276
+ *
277
+ * @param origins - New origin points (DXF group codes **92** / **10**).
278
+ */
279
+ AcDbProxyEntity.prototype.setEntityOrigins = function (origins) {
280
+ this._entityOrigins = origins.map(function (origin) { return new AcGePoint3d(origin.x, origin.y, origin.z); });
281
+ };
282
+ Object.defineProperty(AcDbProxyEntity.prototype, "geometricExtents", {
283
+ /**
284
+ * Gets the geometric extents of this proxy entity.
285
+ *
286
+ * When the proxy-graphic stream contains an {@link AcDbProxyGraphicType.Extents}
287
+ * chunk, the returned box is built from its minimum and maximum corners.
288
+ * Otherwise an empty {@link AcGeBox3d} is returned.
289
+ *
290
+ * @returns The axis-aligned bounding box derived from proxy graphics.
291
+ */
292
+ get: function () {
293
+ var graphic = this._proxyGraphic;
294
+ if (!(graphic === null || graphic === void 0 ? void 0 : graphic.length)) {
295
+ return new AcGeBox3d();
296
+ }
297
+ var parser = new AcDbProxyGraphic(graphic, {
298
+ database: this.database,
299
+ defaultLayer: this.layer
300
+ });
301
+ var extents = parser.scanExtents();
302
+ if (extents) {
303
+ return new AcGeBox3d().setFromPoints(extents);
304
+ }
305
+ return new AcGeBox3d();
306
+ },
307
+ enumerable: false,
308
+ configurable: true
309
+ });
310
+ /**
311
+ * Transforms this proxy entity by the specified matrix.
312
+ *
313
+ * Only {@link entityOrigins} are modified. The proxy-graphic byte stream is
314
+ * left unchanged because transforms are encoded as {@link AcDbProxyGraphicType.PushMatrix}
315
+ * / {@link AcDbProxyGraphicType.PopMatrix} commands inside the stream and
316
+ * applied at render time by {@link AcDbProxyGraphic}.
317
+ *
318
+ * @param matrix - Transformation matrix to apply to entity origins.
319
+ * @returns This entity for chaining.
320
+ */
321
+ AcDbProxyEntity.prototype.transformBy = function (matrix) {
322
+ this._entityOrigins.forEach(function (origin) { return origin.applyMatrix4(matrix); });
323
+ return this;
324
+ };
325
+ /**
326
+ * Draws proxy graphics by decoding the binary stream and emitting primitives
327
+ * through the renderer.
328
+ *
329
+ * This is the primary world-space draw entry point for proxy entities. It
330
+ * delegates to {@link AcDbProxyGraphic.worldDraw} using the entity database
331
+ * and layer as rendering context.
332
+ *
333
+ * @param renderer - Target graphics renderer.
334
+ * @returns A grouped {@link AcGiEntity} when geometry was emitted, otherwise
335
+ * `undefined`.
336
+ */
337
+ AcDbProxyEntity.prototype.subWorldDraw = function (renderer) {
338
+ var graphic = this._proxyGraphic;
339
+ if (!(graphic === null || graphic === void 0 ? void 0 : graphic.length)) {
340
+ return undefined;
341
+ }
342
+ var parser = new AcDbProxyGraphic(graphic, {
343
+ database: this.database,
344
+ defaultLayer: this.layer
345
+ });
346
+ return parser.worldDraw(renderer);
347
+ };
348
+ /**
349
+ * Writes DXF subclass fields for this proxy entity.
350
+ *
351
+ * Emits the `AcDbProxyEntity` subclass marker followed by group codes **1**,
352
+ * **3**, **1001**, **90**, **91**, **92**, **10**, **160**, and **310** as
353
+ * appropriate.
354
+ *
355
+ * @param filer - DXF output filer.
356
+ * @returns This entity for chaining.
357
+ */
358
+ AcDbProxyEntity.prototype.dxfOutFields = function (filer) {
359
+ var _a;
360
+ _super.prototype.dxfOutFields.call(this, filer);
361
+ filer.writeSubclassMarker('AcDbProxyEntity');
362
+ filer.writeString(1, this._originalDxfName);
363
+ if (this._originalClassName) {
364
+ filer.writeString(3, this._originalClassName);
365
+ }
366
+ if (this._applicationName) {
367
+ filer.writeString(1001, this._applicationName);
368
+ }
369
+ filer.writeInt32(90, this._proxyEntityClassId);
370
+ filer.writeInt32(91, this._graphicsMetafileType);
371
+ if (this._entityOrigins.length > 0) {
372
+ filer.writeInt32(92, this._entityOrigins.length);
373
+ this._entityOrigins.forEach(function (origin) {
374
+ filer.writePoint3d(10, origin);
375
+ });
376
+ }
377
+ if ((_a = this._proxyGraphic) === null || _a === void 0 ? void 0 : _a.length) {
378
+ filer.writeInt32(160, this._proxyGraphic.length);
379
+ var index = 0;
380
+ while (index < this._proxyGraphic.length) {
381
+ var chunk = this._proxyGraphic.subarray(index, index + 127);
382
+ filer.writeString(310, bytesToHexString(chunk));
383
+ index += 127;
384
+ }
385
+ }
386
+ return this;
387
+ };
388
+ /**
389
+ * Loads proxy-graphic bytes from DXF group codes **160** and **310**.
390
+ *
391
+ * @param length - Expected byte length from group code **160**. When provided
392
+ * and positive, the result is truncated to this length.
393
+ * @param hexChunks - One or more hexadecimal strings from group code **310**.
394
+ */
395
+ AcDbProxyEntity.prototype.loadProxyGraphicFromDxf = function (length, hexChunks) {
396
+ var data = loadAcDbProxyGraphicFromDxf(length, hexChunks);
397
+ if (data) {
398
+ this.setProxyGraphic(data);
399
+ }
400
+ };
401
+ /**
402
+ * The runtime entity type name used by {@link AcDbEntity.type}.
403
+ *
404
+ * Always `'ProxyEntity'`.
405
+ */
406
+ AcDbProxyEntity.typeName = 'ProxyEntity';
407
+ return AcDbProxyEntity;
408
+ }(AcDbEntity));
409
+ export { AcDbProxyEntity };
410
+ //# sourceMappingURL=AcDbProxyEntity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AcDbProxyEntity.js","sourceRoot":"","sources":["../../src/entity/AcDbProxyEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAgB,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAIjF,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,2BAA2B,EAC5B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH;IAAq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CAAC,IAAI,CAAC,CAAA;QAC5B,CAAC;IACH,CAAC;IA9UD;;;;OAIG;IACa,wBAAQ,GAAW,aAAa,AAAxB,CAAwB;IA0UlD,sBAAC;CAAA,AAhVD,CAAqC,UAAU,GAgV9C;SAhVY,eAAe"}
@@ -27,6 +27,7 @@ export type { AcDbTableBorderColors, AcDbTableCell, AcDbTableCellTypeOverride }
27
27
  export { AcDbText, AcDbTextHorizontalMode, AcDbTextVerticalMode } from './AcDbText';
28
28
  export { AcDbTrace } from './AcDbTrace';
29
29
  export { AcDbPolyline, offsetVertexPathAsPolyline } from './AcDbPolyline';
30
+ export { AcDbProxyEntity } from './AcDbProxyEntity';
30
31
  export { AcDbPoint } from './AcDbPoint';
31
32
  export { AcDbRasterImage, AcDbRasterImageClipBoundaryType, AcDbRasterImageImageDisplayOpt } from './AcDbRasterImage';
32
33
  export { AcDbRay } from './AcDbRay';