@mlightcad/data-model 1.7.30 → 1.7.32

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 (51) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +224 -224
  3. package/dist/data-model.cjs +6 -6
  4. package/dist/data-model.js +14034 -13461
  5. package/lib/base/AcDbDxfFiler.d.ts.map +1 -1
  6. package/lib/base/AcDbDxfFiler.js +4 -1
  7. package/lib/base/AcDbDxfFiler.js.map +1 -1
  8. package/lib/converter/AcDbDxfConverter.d.ts.map +1 -1
  9. package/lib/converter/AcDbDxfConverter.js +19 -1
  10. package/lib/converter/AcDbDxfConverter.js.map +1 -1
  11. package/lib/converter/AcDbEntitiyConverter.d.ts.map +1 -1
  12. package/lib/converter/AcDbEntitiyConverter.js +31 -5
  13. package/lib/converter/AcDbEntitiyConverter.js.map +1 -1
  14. package/lib/database/AcDbDatabase.d.ts +38 -1
  15. package/lib/database/AcDbDatabase.d.ts.map +1 -1
  16. package/lib/database/AcDbDatabase.js +116 -1
  17. package/lib/database/AcDbDatabase.js.map +1 -1
  18. package/lib/database/AcDbSysVarManager.d.ts +5 -3
  19. package/lib/database/AcDbSysVarManager.d.ts.map +1 -1
  20. package/lib/database/AcDbSysVarManager.js +161 -5
  21. package/lib/database/AcDbSysVarManager.js.map +1 -1
  22. package/lib/database/AcDbSystemVariables.d.ts +25 -1
  23. package/lib/database/AcDbSystemVariables.d.ts.map +1 -1
  24. package/lib/database/AcDbSystemVariables.js +24 -0
  25. package/lib/database/AcDbSystemVariables.js.map +1 -1
  26. package/lib/entity/AcDbEntity.d.ts +26 -0
  27. package/lib/entity/AcDbEntity.d.ts.map +1 -1
  28. package/lib/entity/AcDbEntity.js +51 -12
  29. package/lib/entity/AcDbEntity.js.map +1 -1
  30. package/lib/entity/AcDbHatch.d.ts +84 -0
  31. package/lib/entity/AcDbHatch.d.ts.map +1 -1
  32. package/lib/entity/AcDbHatch.js +373 -11
  33. package/lib/entity/AcDbHatch.js.map +1 -1
  34. package/lib/entity/AcDbText.d.ts +46 -1
  35. package/lib/entity/AcDbText.d.ts.map +1 -1
  36. package/lib/entity/AcDbText.js +133 -3
  37. package/lib/entity/AcDbText.js.map +1 -1
  38. package/lib/misc/AcDbConstants.d.ts +20 -0
  39. package/lib/misc/AcDbConstants.d.ts.map +1 -1
  40. package/lib/misc/AcDbConstants.js +20 -0
  41. package/lib/misc/AcDbConstants.js.map +1 -1
  42. package/lib/misc/AcDbDataGenerator.js +2 -2
  43. package/lib/misc/AcDbDataGenerator.js.map +1 -1
  44. package/lib/misc/pat/AcDbPatPredefined.d.ts.map +1 -1
  45. package/lib/misc/pat/AcDbPatPredefined.js +85 -105
  46. package/lib/misc/pat/AcDbPatPredefined.js.map +1 -1
  47. package/lib/misc/pat/AcDbPatSvgRenderer.d.ts +170 -10
  48. package/lib/misc/pat/AcDbPatSvgRenderer.d.ts.map +1 -1
  49. package/lib/misc/pat/AcDbPatSvgRenderer.js +280 -17
  50. package/lib/misc/pat/AcDbPatSvgRenderer.js.map +1 -1
  51. package/package.json +4 -4
@@ -1,6 +1,8 @@
1
+ import { AcCmColor } from '@mlightcad/common';
1
2
  import { AcGeBox3d, AcGeLoop2dType, AcGeMatrix3d } from '@mlightcad/geometry-engine';
2
3
  import { AcGiHatchPatternLine, AcGiRenderer } from '@mlightcad/graphic-interface';
3
4
  import { AcDbDxfFiler } from '../base';
5
+ import type { AcDbDatabase } from '../database/AcDbDatabase';
4
6
  import { AcDbEntity } from './AcDbEntity';
5
7
  import { AcDbEntityProperties } from './AcDbEntityProperties';
6
8
  /**
@@ -123,16 +125,42 @@ export declare class AcDbHatch extends AcDbEntity {
123
125
  private _elevation;
124
126
  /** The definition lines for the hatch pattern */
125
127
  private _definitionLines;
128
+ /** Whether current definition lines were generated from a predefined PAT entry. */
129
+ private _definitionLinesAutoGenerated;
130
+ /** Pattern name used for the current auto-generated definition lines. */
131
+ private _definitionLinesPatternName;
132
+ /** Pattern scale used for the current auto-generated definition lines. */
133
+ private _definitionLinesPatternScale;
126
134
  /** The name of the hatch pattern */
127
135
  private _patternName;
136
+ /** Whether the pattern name was assigned explicitly instead of coming from HPNAME. */
137
+ private _patternNameSet;
128
138
  /** The type of hatch pattern */
129
139
  private _patternType;
130
140
  /** The angle of the hatch pattern in radians */
131
141
  private _patternAngle;
142
+ /** Whether the pattern angle was assigned explicitly instead of coming from HPANG. */
143
+ private _patternAngleSet;
132
144
  /** The scale factor for the hatch pattern */
133
145
  private _patternScale;
146
+ /** Whether the pattern scale was assigned explicitly instead of coming from HPSCALE. */
147
+ private _patternScaleSet;
148
+ /** Whether this hatch is associated with its defining boundary objects. */
149
+ private _associative;
150
+ /** Whether associativity was assigned explicitly instead of coming from HPASSOC. */
151
+ private _associativeSet;
152
+ /** Optional background color for hatch patterns. */
153
+ private _backgroundColor?;
154
+ /** Whether the background color was assigned explicitly instead of coming from HPBACKGROUNDCOLOR. */
155
+ private _backgroundColorSet;
156
+ /** Whether user-defined hatch pattern doubling is enabled. */
157
+ private _patternDouble;
158
+ /** Whether pattern doubling was assigned explicitly instead of coming from HPDOUBLE. */
159
+ private _patternDoubleSet;
134
160
  /** The hatch style for determining which areas to hatch */
135
161
  private _hatchStyle;
162
+ /** Whether the hatch style was assigned explicitly instead of coming from HPISLANDDETECTION. */
163
+ private _hatchStyleSet;
136
164
  /**
137
165
  * The current state of the gradient object.
138
166
  */
@@ -191,6 +219,17 @@ export declare class AcDbHatch extends AcDbEntity {
191
219
  * Sets whether the hatch object is configured for solid fill.
192
220
  */
193
221
  set isSolidFill(value: boolean);
222
+ /**
223
+ * Gets the effective hatch color.
224
+ *
225
+ * When the hatch does not have an explicit entity color, hatch color follows
226
+ * HPCOLOR first and falls back to CECOLOR when HPCOLOR is unset.
227
+ */
228
+ get color(): AcCmColor;
229
+ /**
230
+ * Sets an explicit hatch entity color.
231
+ */
232
+ set color(value: AcCmColor);
194
233
  /**
195
234
  * Gets the definition lines for the hatch pattern.
196
235
  *
@@ -223,6 +262,21 @@ export declare class AcDbHatch extends AcDbEntity {
223
262
  */
224
263
  get patternScale(): number;
225
264
  set patternScale(value: number);
265
+ /**
266
+ * Indicates whether this hatch is associative with its defining boundary objects.
267
+ */
268
+ get associative(): boolean;
269
+ set associative(value: boolean);
270
+ /**
271
+ * Optional background color of this hatch pattern.
272
+ */
273
+ get backgroundColor(): AcCmColor | undefined;
274
+ set backgroundColor(value: AcCmColor | undefined);
275
+ /**
276
+ * Indicates whether user-defined hatch pattern doubling is enabled.
277
+ */
278
+ get patternDouble(): boolean;
279
+ set patternDouble(value: boolean);
226
280
  /**
227
281
  * The pattern style of the hatch entity.
228
282
  */
@@ -310,6 +364,36 @@ export declare class AcDbHatch extends AcDbEntity {
310
364
  * Sets the optional second gradient color as a packed RGB value.
311
365
  */
312
366
  set gradientEndColor(value: number | undefined);
367
+ /**
368
+ * Applies the current hatch-related system variables as persistent defaults
369
+ * when this hatch is first added to a database.
370
+ *
371
+ * Imported hatches and programmatically assigned hatch values keep their own
372
+ * explicit settings.
373
+ *
374
+ * @internal
375
+ */
376
+ applyPatternDefaultsFromSysVars(db: AcDbDatabase): void;
377
+ private getEffectivePatternName;
378
+ protected shouldResolveColorFromCecolor(): boolean;
379
+ private getEffectivePatternAngle;
380
+ private getEffectivePatternScale;
381
+ private getEffectiveAssociative;
382
+ private normalizePatternScale;
383
+ private normalizeHatchStyle;
384
+ private shouldUseSysVarOverride;
385
+ private parseHpBackgroundColor;
386
+ private parseHpTransparency;
387
+ /**
388
+ * Populates renderable pattern definition lines for predefined hatch names.
389
+ *
390
+ * `patternName`, `patternScale`, and `patternType` are the persistent hatch
391
+ * metadata. Renderers consume `definitionLines`, so newly-created predefined
392
+ * hatches need those lines expanded from the bundled PAT library. Imported
393
+ * files usually already contain explicit definition lines; those are kept
394
+ * intact unless they were previously auto-generated by this object.
395
+ */
396
+ private updatePredefinedPatternDefinitionLines;
313
397
  /**
314
398
  * Append one loop to loops of this area. If it is the first loop added, it is the outter loop.
315
399
  * Otherwise, it is an inner loop.
@@ -1 +1 @@
1
- {"version":3,"file":"AcDbHatch.d.ts","sourceRoot":"","sources":["../../src/entity/AcDbHatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAMT,cAAc,EAEd,YAAY,EAKb,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,oBAAoB,EACpB,YAAY,EACb,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D;;GAEG;AACH,oBAAY,oBAAoB;IAC9B;;;;;;;;OAQG;IACH,WAAW,IAAI;IACf;;;;;;;;OAQG;IACH,UAAU,IAAI;IACd;;;;;;OAMG;IACH,MAAM,IAAI;CACX;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB;;;;;OAKG;IACH,MAAM,IAAI;IACV;;;;OAIG;IACH,KAAK,IAAI;IACT;;OAEG;IACH,MAAM,IAAI;CACX;AAED,oBAAY,mBAAmB;IAC7B;;OAEG;IACH,WAAW,IAAI;IACf;;OAEG;IACH,cAAc,IAAI;CACnB;AAED,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,UAAU,GACV,aAAa,GACb,WAAW,GACX,cAAc,GACd,eAAe,GACf,kBAAkB,GAClB,QAAQ,GACR,WAAW,CAAA;AAEf;;GAEG;AACH,oBAAY,uBAAuB;IACjC;;OAEG;IACH,kBAAkB,IAAI;IACtB;;OAEG;IACH,mBAAmB,IAAI;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,SAAU,SAAQ,UAAU;IACvC,2BAA2B;IAC3B,OAAgB,QAAQ,EAAE,MAAM,CAAU;IAE1C,IAAa,WAAW,WAEvB;IAED,2CAA2C;IAC3C,OAAO,CAAC,IAAI,CAAY;IACxB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;IACH,IAAI,gBAAgB,cAgBnB;IAED;;;;;;;;;OASG;IACH,IAAI,UAAU,IAAI,oBAAoB,CAsHrC;IAED;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,YAAY;IAgCnC;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,YAAY;IAiChC;;;;;OAKG;IACM,YAAY,CAAC,KAAK,EAAE,YAAY;CAwI1C"}
@@ -24,7 +24,12 @@ var __values = (this && this.__values) || function(o) {
24
24
  };
25
25
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
26
26
  };
27
+ import { AcCmColor, AcCmColorMethod, AcCmTransparency } from '@mlightcad/common';
27
28
  import { AcGeArea2d, AcGeBox3d, AcGeCircArc2d, AcGeEllipseArc2d, AcGeLine2d, AcGeLoop2d, AcGeMatrix2d, AcGePoint2d, AcGePoint3d, AcGePolyline2d, AcGeSpline3d } from '@mlightcad/geometry-engine';
29
+ import { AcDbSystemVariables } from '../database/AcDbSystemVariables';
30
+ import { AcDbSysVarManager } from '../database/AcDbSysVarManager';
31
+ import { DEFAULT_GRADIENT_HATCH_NAME, HATCH_PATTERN_SOLID, HATCH_PATTERN_USER } from '../misc/AcDbConstants';
32
+ import { AcDbPredefinedAcadIsoPat } from '../misc/pat/AcDbPatPredefined';
28
33
  import { AcDbEntity } from './AcDbEntity';
29
34
  /**
30
35
  * Defines the type of hatch pattern.
@@ -161,11 +166,24 @@ var AcDbHatch = /** @class */ (function (_super) {
161
166
  _this._geo = new AcGeArea2d();
162
167
  _this._isSolidFill = false;
163
168
  _this._definitionLines = [];
169
+ _this._definitionLinesAutoGenerated = false;
170
+ _this._definitionLinesPatternName = '';
171
+ _this._definitionLinesPatternScale = 1;
164
172
  _this._patternName = '';
173
+ _this._patternNameSet = false;
165
174
  _this._patternType = AcDbHatchPatternType.Predefined;
166
175
  _this._patternAngle = 0;
176
+ _this._patternAngleSet = false;
167
177
  _this._patternScale = 1;
178
+ _this._patternScaleSet = false;
179
+ _this._associative = false;
180
+ _this._associativeSet = false;
181
+ _this._backgroundColor = undefined;
182
+ _this._backgroundColorSet = false;
183
+ _this._patternDouble = false;
184
+ _this._patternDoubleSet = false;
168
185
  _this._hatchStyle = AcDbHatchStyle.Normal;
186
+ _this._hatchStyleSet = false;
169
187
  _this._hatchObjectType = AcDbHatchObjectType.HatchObject;
170
188
  _this._gradientAngle = 0;
171
189
  _this._gradientShift = 0;
@@ -209,7 +227,9 @@ var AcDbHatch = /** @class */ (function (_super) {
209
227
  * Gets whether the hatch object is configured for solid fill.
210
228
  */
211
229
  get: function () {
212
- return this._isSolidFill || this._patternName.toUpperCase() === 'SOLID';
230
+ return (this._isSolidFill ||
231
+ this.getEffectivePatternName().trim().toUpperCase() ===
232
+ HATCH_PATTERN_SOLID);
213
233
  },
214
234
  /**
215
235
  * Sets whether the hatch object is configured for solid fill.
@@ -220,6 +240,34 @@ var AcDbHatch = /** @class */ (function (_super) {
220
240
  enumerable: false,
221
241
  configurable: true
222
242
  });
243
+ Object.defineProperty(AcDbHatch.prototype, "color", {
244
+ /**
245
+ * Gets the effective hatch color.
246
+ *
247
+ * When the hatch does not have an explicit entity color, hatch color follows
248
+ * HPCOLOR first and falls back to CECOLOR when HPCOLOR is unset.
249
+ */
250
+ get: function () {
251
+ if (this.hasExplicitColor()) {
252
+ return this.getEntityColor();
253
+ }
254
+ var db = this.database;
255
+ var hpColor = AcDbSysVarManager.instance().getVar(AcDbSystemVariables.HPCOLOR, db);
256
+ if (hpColor instanceof AcCmColor &&
257
+ hpColor.colorMethod !== AcCmColorMethod.None) {
258
+ return hpColor.clone();
259
+ }
260
+ return db.cecolor.clone();
261
+ },
262
+ /**
263
+ * Sets an explicit hatch entity color.
264
+ */
265
+ set: function (value) {
266
+ this.setEntityColor(value);
267
+ },
268
+ enumerable: false,
269
+ configurable: true
270
+ });
223
271
  Object.defineProperty(AcDbHatch.prototype, "definitionLines", {
224
272
  /**
225
273
  * Gets the definition lines for the hatch pattern.
@@ -246,7 +294,11 @@ var AcDbHatch = /** @class */ (function (_super) {
246
294
  return this._patternName;
247
295
  },
248
296
  set: function (value) {
249
- this._patternName = value;
297
+ this._patternName = value !== null && value !== void 0 ? value : '';
298
+ this._isSolidFill =
299
+ this._patternName.trim().toUpperCase() === HATCH_PATTERN_SOLID;
300
+ this._patternNameSet = true;
301
+ this.updatePredefinedPatternDefinitionLines();
250
302
  },
251
303
  enumerable: false,
252
304
  configurable: true
@@ -260,6 +312,14 @@ var AcDbHatch = /** @class */ (function (_super) {
260
312
  },
261
313
  set: function (value) {
262
314
  this._patternType = value;
315
+ if (value !== AcDbHatchPatternType.Predefined &&
316
+ this._definitionLinesAutoGenerated) {
317
+ this._definitionLines = [];
318
+ this._definitionLinesAutoGenerated = false;
319
+ this._definitionLinesPatternName = '';
320
+ this._definitionLinesPatternScale = 1;
321
+ }
322
+ this.updatePredefinedPatternDefinitionLines();
263
323
  },
264
324
  enumerable: false,
265
325
  configurable: true
@@ -273,6 +333,7 @@ var AcDbHatch = /** @class */ (function (_super) {
273
333
  },
274
334
  set: function (value) {
275
335
  this._patternAngle = value;
336
+ this._patternAngleSet = true;
276
337
  },
277
338
  enumerable: false,
278
339
  configurable: true
@@ -286,6 +347,50 @@ var AcDbHatch = /** @class */ (function (_super) {
286
347
  },
287
348
  set: function (value) {
288
349
  this._patternScale = value;
350
+ this._patternScaleSet = true;
351
+ this.updatePredefinedPatternDefinitionLines();
352
+ },
353
+ enumerable: false,
354
+ configurable: true
355
+ });
356
+ Object.defineProperty(AcDbHatch.prototype, "associative", {
357
+ /**
358
+ * Indicates whether this hatch is associative with its defining boundary objects.
359
+ */
360
+ get: function () {
361
+ return this._associative;
362
+ },
363
+ set: function (value) {
364
+ this._associative = !!value;
365
+ this._associativeSet = true;
366
+ },
367
+ enumerable: false,
368
+ configurable: true
369
+ });
370
+ Object.defineProperty(AcDbHatch.prototype, "backgroundColor", {
371
+ /**
372
+ * Optional background color of this hatch pattern.
373
+ */
374
+ get: function () {
375
+ return this._backgroundColor;
376
+ },
377
+ set: function (value) {
378
+ this._backgroundColor = value === null || value === void 0 ? void 0 : value.clone();
379
+ this._backgroundColorSet = true;
380
+ },
381
+ enumerable: false,
382
+ configurable: true
383
+ });
384
+ Object.defineProperty(AcDbHatch.prototype, "patternDouble", {
385
+ /**
386
+ * Indicates whether user-defined hatch pattern doubling is enabled.
387
+ */
388
+ get: function () {
389
+ return this._patternDouble;
390
+ },
391
+ set: function (value) {
392
+ this._patternDouble = !!value;
393
+ this._patternDoubleSet = true;
289
394
  },
290
395
  enumerable: false,
291
396
  configurable: true
@@ -299,6 +404,7 @@ var AcDbHatch = /** @class */ (function (_super) {
299
404
  },
300
405
  set: function (value) {
301
406
  this._hatchStyle = value;
407
+ this._hatchStyleSet = true;
302
408
  },
303
409
  enumerable: false,
304
410
  configurable: true
@@ -387,13 +493,16 @@ var AcDbHatch = /** @class */ (function (_super) {
387
493
  * Gets the name of the current gradient.
388
494
  */
389
495
  get: function () {
496
+ if (this.isGradient && this._gradientName.trim() === '') {
497
+ return DEFAULT_GRADIENT_HATCH_NAME;
498
+ }
390
499
  return this._gradientName;
391
500
  },
392
501
  /**
393
502
  * Sets the name of the current gradient.
394
503
  */
395
504
  set: function (value) {
396
- this._gradientName = value;
505
+ this._gradientName = value !== null && value !== void 0 ? value : '';
397
506
  },
398
507
  enumerable: false,
399
508
  configurable: true
@@ -467,6 +576,215 @@ var AcDbHatch = /** @class */ (function (_super) {
467
576
  enumerable: false,
468
577
  configurable: true
469
578
  });
579
+ /**
580
+ * Applies the current hatch-related system variables as persistent defaults
581
+ * when this hatch is first added to a database.
582
+ *
583
+ * Imported hatches and programmatically assigned hatch values keep their own
584
+ * explicit settings.
585
+ *
586
+ * @internal
587
+ */
588
+ AcDbHatch.prototype.applyPatternDefaultsFromSysVars = function (db) {
589
+ var manager = AcDbSysVarManager.instance();
590
+ if (!this.hasExplicitLayer()) {
591
+ var layer = manager.getVar(AcDbSystemVariables.HPLAYER, db);
592
+ if (this.shouldUseSysVarOverride(layer)) {
593
+ this.layer = layer;
594
+ }
595
+ }
596
+ if (!this.hasExplicitTransparency()) {
597
+ var transparency = this.parseHpTransparency(manager.getVar(AcDbSystemVariables.HPTRANSPARENCY, db));
598
+ if (transparency) {
599
+ this.transparency = transparency;
600
+ }
601
+ }
602
+ if (!this._backgroundColorSet) {
603
+ this._backgroundColor = this.parseHpBackgroundColor(manager.getVar(AcDbSystemVariables.HPBACKGROUNDCOLOR, db));
604
+ this._backgroundColorSet = true;
605
+ }
606
+ if (!this._patternNameSet) {
607
+ var patternName = manager.getVar(AcDbSystemVariables.HPNAME, db);
608
+ this._patternName = typeof patternName === 'string' ? patternName : '';
609
+ this._patternNameSet = true;
610
+ }
611
+ if (!this._patternAngleSet) {
612
+ var patternAngle = manager.getVar(AcDbSystemVariables.HPANG, db);
613
+ this._patternAngle =
614
+ typeof patternAngle === 'number' && Number.isFinite(patternAngle)
615
+ ? patternAngle
616
+ : 0;
617
+ this._patternAngleSet = true;
618
+ }
619
+ if (!this._patternScaleSet) {
620
+ this._patternScale = this.normalizePatternScale(manager.getVar(AcDbSystemVariables.HPSCALE, db));
621
+ this._patternScaleSet = true;
622
+ }
623
+ if (!this._associativeSet) {
624
+ var hpAssoc = manager.getVar(AcDbSystemVariables.HPASSOC, db);
625
+ this._associative = typeof hpAssoc === 'number' ? hpAssoc !== 0 : false;
626
+ this._associativeSet = true;
627
+ }
628
+ if (!this._hatchStyleSet) {
629
+ this._hatchStyle = this.normalizeHatchStyle(manager.getVar(AcDbSystemVariables.HPISLANDDETECTION, db));
630
+ this._hatchStyleSet = true;
631
+ }
632
+ if (!this._patternDoubleSet) {
633
+ var hpDouble = manager.getVar(AcDbSystemVariables.HPDOUBLE, db);
634
+ this._patternDouble =
635
+ typeof hpDouble === 'number' ? hpDouble !== 0 : false;
636
+ this._patternDoubleSet = true;
637
+ }
638
+ this.updatePredefinedPatternDefinitionLines();
639
+ };
640
+ AcDbHatch.prototype.getEffectivePatternName = function () {
641
+ if (this._patternNameSet) {
642
+ return this._patternName;
643
+ }
644
+ var db = this.database;
645
+ var value = AcDbSysVarManager.instance().getVar(AcDbSystemVariables.HPNAME, db);
646
+ return typeof value === 'string' ? value : this._patternName;
647
+ };
648
+ AcDbHatch.prototype.shouldResolveColorFromCecolor = function () {
649
+ return false;
650
+ };
651
+ AcDbHatch.prototype.getEffectivePatternAngle = function () {
652
+ if (this._patternAngleSet) {
653
+ return this._patternAngle;
654
+ }
655
+ var db = this.database;
656
+ var value = AcDbSysVarManager.instance().getVar(AcDbSystemVariables.HPANG, db);
657
+ return typeof value === 'number' && Number.isFinite(value)
658
+ ? value
659
+ : this._patternAngle;
660
+ };
661
+ AcDbHatch.prototype.getEffectivePatternScale = function () {
662
+ if (this._patternScaleSet) {
663
+ return this._patternScale;
664
+ }
665
+ var db = this.database;
666
+ return this.normalizePatternScale(AcDbSysVarManager.instance().getVar(AcDbSystemVariables.HPSCALE, db));
667
+ };
668
+ AcDbHatch.prototype.getEffectiveAssociative = function () {
669
+ if (this._associativeSet) {
670
+ return this._associative;
671
+ }
672
+ var db = this.database;
673
+ var value = AcDbSysVarManager.instance().getVar(AcDbSystemVariables.HPASSOC, db);
674
+ return typeof value === 'number' ? value !== 0 : this._associative;
675
+ };
676
+ AcDbHatch.prototype.normalizePatternScale = function (value) {
677
+ return typeof value === 'number' && Number.isFinite(value) && value > 0
678
+ ? value
679
+ : 1;
680
+ };
681
+ AcDbHatch.prototype.normalizeHatchStyle = function (value) {
682
+ if (typeof value !== 'number' || !Number.isFinite(value)) {
683
+ return AcDbHatchStyle.Outer;
684
+ }
685
+ if (value === AcDbHatchStyle.Normal)
686
+ return AcDbHatchStyle.Normal;
687
+ if (value === AcDbHatchStyle.Ignore)
688
+ return AcDbHatchStyle.Ignore;
689
+ return AcDbHatchStyle.Outer;
690
+ };
691
+ AcDbHatch.prototype.shouldUseSysVarOverride = function (value) {
692
+ if (typeof value !== 'string')
693
+ return false;
694
+ var normalized = value.trim().toLowerCase();
695
+ return (normalized !== '' && normalized !== '.' && normalized !== 'use current');
696
+ };
697
+ AcDbHatch.prototype.parseHpBackgroundColor = function (value) {
698
+ if (value instanceof AcCmColor) {
699
+ return value.colorMethod === AcCmColorMethod.None
700
+ ? undefined
701
+ : value.clone();
702
+ }
703
+ if (typeof value !== 'string')
704
+ return undefined;
705
+ var normalized = value.trim().toLowerCase();
706
+ if (!normalized || normalized === '.' || normalized === 'none') {
707
+ return undefined;
708
+ }
709
+ return AcCmColor.fromString(value);
710
+ };
711
+ AcDbHatch.prototype.parseHpTransparency = function (value) {
712
+ if (value instanceof AcCmTransparency) {
713
+ return value.clone();
714
+ }
715
+ if (!this.shouldUseSysVarOverride(value)) {
716
+ return undefined;
717
+ }
718
+ var text = value.trim();
719
+ if (/^bylayer$/i.test(text) || /^byblock$/i.test(text)) {
720
+ return AcCmTransparency.fromString(text);
721
+ }
722
+ var percentage = Number(text);
723
+ if (Number.isInteger(percentage) && percentage >= 0 && percentage <= 90) {
724
+ var transparency = new AcCmTransparency();
725
+ transparency.percentage = percentage;
726
+ return transparency;
727
+ }
728
+ return undefined;
729
+ };
730
+ /**
731
+ * Populates renderable pattern definition lines for predefined hatch names.
732
+ *
733
+ * `patternName`, `patternScale`, and `patternType` are the persistent hatch
734
+ * metadata. Renderers consume `definitionLines`, so newly-created predefined
735
+ * hatches need those lines expanded from the bundled PAT library. Imported
736
+ * files usually already contain explicit definition lines; those are kept
737
+ * intact unless they were previously auto-generated by this object.
738
+ */
739
+ AcDbHatch.prototype.updatePredefinedPatternDefinitionLines = function (patternName, patternScale) {
740
+ if (patternName === void 0) { patternName = this.getEffectivePatternName(); }
741
+ if (patternScale === void 0) { patternScale = this.getEffectivePatternScale(); }
742
+ if (this.patternType !== AcDbHatchPatternType.Predefined)
743
+ return;
744
+ var canReplace = this._definitionLinesAutoGenerated || this._definitionLines.length === 0;
745
+ if (!canReplace)
746
+ return;
747
+ var normalizedPatternName = patternName.trim().toUpperCase();
748
+ if (!normalizedPatternName ||
749
+ normalizedPatternName === HATCH_PATTERN_SOLID) {
750
+ this._definitionLines = [];
751
+ this._definitionLinesAutoGenerated = false;
752
+ this._definitionLinesPatternName = '';
753
+ this._definitionLinesPatternScale = 1;
754
+ return;
755
+ }
756
+ var scale = this.normalizePatternScale(patternScale);
757
+ if (this._definitionLinesAutoGenerated &&
758
+ this._definitionLinesPatternName === normalizedPatternName &&
759
+ this._definitionLinesPatternScale === scale) {
760
+ return;
761
+ }
762
+ var pattern = AcDbPredefinedAcadIsoPat.patterns.find(function (item) { return item.name.trim().toUpperCase() === normalizedPatternName; });
763
+ if (!pattern) {
764
+ if (this._definitionLinesAutoGenerated) {
765
+ this._definitionLines = [];
766
+ this._definitionLinesAutoGenerated = false;
767
+ this._definitionLinesPatternName = '';
768
+ this._definitionLinesPatternScale = 1;
769
+ }
770
+ return;
771
+ }
772
+ this._definitionLines = pattern.lines.map(function (line) { return ({
773
+ angle: (line.angle * Math.PI) / 180,
774
+ base: {
775
+ x: line.originX * scale,
776
+ y: line.originY * scale
777
+ },
778
+ offset: {
779
+ x: line.deltaX * scale,
780
+ y: line.deltaY * scale
781
+ },
782
+ dashLengths: line.dashes.map(function (dash) { return dash * scale; })
783
+ }); });
784
+ this._definitionLinesAutoGenerated = true;
785
+ this._definitionLinesPatternName = normalizedPatternName;
786
+ this._definitionLinesPatternScale = scale;
787
+ };
470
788
  /**
471
789
  * Append one loop to loops of this area. If it is the first loop added, it is the outter loop.
472
790
  * Otherwise, it is an inner loop.
@@ -593,6 +911,39 @@ var AcDbHatch = /** @class */ (function (_super) {
593
911
  _this.patternScale = v;
594
912
  }
595
913
  }
914
+ },
915
+ {
916
+ name: 'associative',
917
+ type: 'boolean',
918
+ editable: true,
919
+ accessor: {
920
+ get: function () { return _this.associative; },
921
+ set: function (v) {
922
+ _this.associative = v;
923
+ }
924
+ }
925
+ },
926
+ {
927
+ name: 'backgroundColor',
928
+ type: 'color',
929
+ editable: true,
930
+ accessor: {
931
+ get: function () { return _this.backgroundColor; },
932
+ set: function (v) {
933
+ _this.backgroundColor = v;
934
+ }
935
+ }
936
+ },
937
+ {
938
+ name: 'patternDouble',
939
+ type: 'boolean',
940
+ editable: true,
941
+ accessor: {
942
+ get: function () { return _this.patternDouble; },
943
+ set: function (v) {
944
+ _this.patternDouble = v;
945
+ }
946
+ }
596
947
  }
597
948
  ]
598
949
  },
@@ -630,11 +981,14 @@ var AcDbHatch = /** @class */ (function (_super) {
630
981
  * @inheritdoc
631
982
  */
632
983
  AcDbHatch.prototype.subWorldDraw = function (renderer) {
984
+ var _a;
985
+ this.updatePredefinedPatternDefinitionLines();
633
986
  var traits = renderer.subEntityTraits;
634
987
  traits.fillType = {
635
988
  solidFill: this.isSolidFill,
636
- patternAngle: this.patternAngle,
989
+ patternAngle: this.getEffectivePatternAngle(),
637
990
  definitionLines: this.definitionLines,
991
+ backgroundColor: (_a = this.backgroundColor) === null || _a === void 0 ? void 0 : _a.clone(),
638
992
  gradient: this.isGradient
639
993
  ? {
640
994
  name: this.gradientName,
@@ -671,9 +1025,12 @@ var AcDbHatch = /** @class */ (function (_super) {
671
1025
  var xVector = new AcGePoint3d(xAxis).sub(origin);
672
1026
  if (xVector.length() > 0) {
673
1027
  var rotation = Math.atan2(xVector.y, xVector.x);
674
- this._patternAngle += rotation;
1028
+ this._patternAngle = this.getEffectivePatternAngle() + rotation;
675
1029
  this._gradientAngle += rotation;
676
- this._patternScale *= xVector.length();
1030
+ this._patternScale = this.getEffectivePatternScale() * xVector.length();
1031
+ this._patternAngleSet = true;
1032
+ this._patternScaleSet = true;
1033
+ this.updatePredefinedPatternDefinitionLines();
677
1034
  }
678
1035
  return this;
679
1036
  };
@@ -686,12 +1043,17 @@ var AcDbHatch = /** @class */ (function (_super) {
686
1043
  AcDbHatch.prototype.dxfOutFields = function (filer) {
687
1044
  _super.prototype.dxfOutFields.call(this, filer);
688
1045
  var loops = this._geo.loops;
1046
+ var patternName = this.getEffectivePatternName();
1047
+ var patternAngle = this.getEffectivePatternAngle();
1048
+ var patternScale = this.getEffectivePatternScale();
1049
+ this.updatePredefinedPatternDefinitionLines(patternName, patternScale);
689
1050
  filer.writeSubclassMarker('AcDbHatch');
690
1051
  filer.writePoint3d(10, { x: 0, y: 0, z: this.elevation });
691
1052
  filer.writeVector3d(210, { x: 0, y: 0, z: 1 });
692
- filer.writeString(2, this.patternName || (this.isSolidFill ? 'SOLID' : 'USER'));
1053
+ filer.writeString(2, patternName ||
1054
+ (this.isSolidFill ? HATCH_PATTERN_SOLID : HATCH_PATTERN_USER));
693
1055
  filer.writeInt16(70, this.isSolidFill ? 1 : 0);
694
- filer.writeInt16(71, 0);
1056
+ filer.writeInt16(71, this.getEffectiveAssociative() ? 1 : 0);
695
1057
  filer.writeInt16(91, loops.length);
696
1058
  loops.forEach(function (loop, index) {
697
1059
  var e_1, _a, e_2, _b;
@@ -800,8 +1162,8 @@ var AcDbHatch = /** @class */ (function (_super) {
800
1162
  });
801
1163
  filer.writeInt16(75, this.hatchStyle);
802
1164
  filer.writeInt16(76, this.patternType);
803
- filer.writeAngle(52, this.patternAngle);
804
- filer.writeDouble(41, this.patternScale);
1165
+ filer.writeAngle(52, patternAngle);
1166
+ filer.writeDouble(41, patternScale);
805
1167
  filer.writeInt16(77, 0);
806
1168
  filer.writeInt16(78, this.definitionLines.length);
807
1169
  this.definitionLines.forEach(function (line) {
@@ -818,7 +1180,7 @@ var AcDbHatch = /** @class */ (function (_super) {
818
1180
  filer.writeInt16(452, this._gradientOneColorMode ? 1 : 0);
819
1181
  filer.writeAngle(460, this._gradientAngle);
820
1182
  filer.writeDouble(461, this._gradientShift);
821
- filer.writeString(470, this._gradientName);
1183
+ filer.writeString(470, this.gradientName);
822
1184
  }
823
1185
  // TODO: Write the number of seed points
824
1186
  filer.writeInt16(98, 0);