@mlightcad/data-model 1.9.10 → 1.9.12
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.
- package/dist/data-model.cjs +7 -7
- package/lib/base/AcDbObject.d.ts +54 -0
- package/lib/base/AcDbObject.d.ts.map +1 -1
- package/lib/base/AcDbObject.js +200 -21
- package/lib/base/AcDbObject.js.map +1 -1
- package/lib/database/AcDbBlockTableRecord.d.ts.map +1 -1
- package/lib/database/AcDbBlockTableRecord.js +61 -15
- package/lib/database/AcDbBlockTableRecord.js.map +1 -1
- package/lib/database/AcDbDatabase.d.ts +131 -4
- package/lib/database/AcDbDatabase.d.ts.map +1 -1
- package/lib/database/AcDbDatabase.js +439 -62
- package/lib/database/AcDbDatabase.js.map +1 -1
- package/lib/database/AcDbSymbolTable.d.ts +9 -0
- package/lib/database/AcDbSymbolTable.d.ts.map +1 -1
- package/lib/database/AcDbSymbolTable.js +34 -4
- package/lib/database/AcDbSymbolTable.js.map +1 -1
- package/lib/database/AcDbSysVarManager.d.ts +13 -0
- package/lib/database/AcDbSysVarManager.d.ts.map +1 -1
- package/lib/database/AcDbSysVarManager.js +43 -11
- package/lib/database/AcDbSysVarManager.js.map +1 -1
- package/lib/database/index.d.ts +2 -0
- package/lib/database/index.d.ts.map +1 -1
- package/lib/database/index.js +1 -0
- package/lib/database/index.js.map +1 -1
- package/lib/database/transaction/AcDbChangeApplier.d.ts +118 -0
- package/lib/database/transaction/AcDbChangeApplier.d.ts.map +1 -0
- package/lib/database/transaction/AcDbChangeApplier.js +310 -0
- package/lib/database/transaction/AcDbChangeApplier.js.map +1 -0
- package/lib/database/transaction/AcDbChangeRecorder.d.ts +113 -0
- package/lib/database/transaction/AcDbChangeRecorder.d.ts.map +1 -0
- package/lib/database/transaction/AcDbChangeRecorder.js +235 -0
- package/lib/database/transaction/AcDbChangeRecorder.js.map +1 -0
- package/lib/database/transaction/AcDbDatabaseChange.d.ts +67 -0
- package/lib/database/transaction/AcDbDatabaseChange.d.ts.map +1 -0
- package/lib/database/transaction/AcDbDatabaseChange.js +23 -0
- package/lib/database/transaction/AcDbDatabaseChange.js.map +1 -0
- package/lib/database/transaction/AcDbDatabaseTransaction.d.ts +26 -0
- package/lib/database/transaction/AcDbDatabaseTransaction.d.ts.map +1 -0
- package/lib/database/transaction/AcDbDatabaseTransaction.js +51 -0
- package/lib/database/transaction/AcDbDatabaseTransaction.js.map +1 -0
- package/lib/database/transaction/AcDbDatabaseTransactionManager.d.ts +188 -0
- package/lib/database/transaction/AcDbDatabaseTransactionManager.d.ts.map +1 -0
- package/lib/database/transaction/AcDbDatabaseTransactionManager.js +594 -0
- package/lib/database/transaction/AcDbDatabaseTransactionManager.js.map +1 -0
- package/lib/database/transaction/AcDbTransaction.d.ts +7 -0
- package/lib/database/transaction/AcDbTransaction.d.ts.map +1 -1
- package/lib/database/transaction/AcDbTransaction.js +20 -10
- package/lib/database/transaction/AcDbTransaction.js.map +1 -1
- package/lib/database/transaction/AcDbTransactionManager.d.ts +3 -4
- package/lib/database/transaction/AcDbTransactionManager.d.ts.map +1 -1
- package/lib/database/transaction/AcDbTransactionManager.js +3 -4
- package/lib/database/transaction/AcDbTransactionManager.js.map +1 -1
- package/lib/database/transaction/AcDbUndoRecord.d.ts +11 -0
- package/lib/database/transaction/AcDbUndoRecord.d.ts.map +1 -0
- package/lib/database/transaction/AcDbUndoRecord.js +2 -0
- package/lib/database/transaction/AcDbUndoRecord.js.map +1 -0
- package/lib/database/transaction/AcDbUndoStack.d.ts +52 -0
- package/lib/database/transaction/AcDbUndoStack.d.ts.map +1 -0
- package/lib/database/transaction/AcDbUndoStack.js +74 -0
- package/lib/database/transaction/AcDbUndoStack.js.map +1 -0
- package/lib/database/transaction/index.d.ts +9 -0
- package/lib/database/transaction/index.d.ts.map +1 -1
- package/lib/database/transaction/index.js +6 -0
- package/lib/database/transaction/index.js.map +1 -1
- package/lib/entity/AcDbEntity.js +4 -4
- package/lib/entity/AcDbEntity.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/object/AcDbDictionary.d.ts +11 -0
- package/lib/object/AcDbDictionary.d.ts.map +1 -1
- package/lib/object/AcDbDictionary.js +65 -20
- package/lib/object/AcDbDictionary.js.map +1 -1
- package/package.json +4 -4
|
@@ -89,6 +89,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
89
89
|
import { AcCmColor, AcCmColorMethod, AcCmEventManager, AcCmTransparency } from '@mlightcad/common';
|
|
90
90
|
import { AcDbDxfFiler } from '../base/AcDbDxfFiler';
|
|
91
91
|
import { AcDbObject } from '../base/AcDbObject';
|
|
92
|
+
import { AcDbOpenMode } from '../base/AcDbOpenMode';
|
|
92
93
|
import { AcDbRegenerator } from '../converter/AcDbRegenerator';
|
|
93
94
|
import { AcDbDatabaseConverterManager, AcDbFileType } from './AcDbDatabaseConverterManager';
|
|
94
95
|
import { ACAD_APPID, ACTIVE_VPORT_NAME, ByBlock, ByLayer, DEFAULT_MLEADER_STYLE, DEFAULT_MLINE_STYLE, DEFAULT_LINE_TYPE, DEFAULT_TEXT_STYLE, MLIGHTCAD_APPID } from '../misc/AcDbConstants';
|
|
@@ -122,6 +123,7 @@ import { AcDbSysVarManager } from './AcDbSysVarManager';
|
|
|
122
123
|
import { AcDbSystemVariables } from './AcDbSystemVariables';
|
|
123
124
|
import { AcDbLayout } from '../object/layout/AcDbLayout';
|
|
124
125
|
import { AcDbLayoutDictionary } from '../object/layout/AcDbLayoutDictionary';
|
|
126
|
+
import { AcDbDatabaseTransactionManager } from './transaction/AcDbDatabaseTransactionManager';
|
|
125
127
|
/**
|
|
126
128
|
* The AcDbDatabase class represents an AutoCAD drawing file.
|
|
127
129
|
*
|
|
@@ -150,6 +152,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
150
152
|
* Set from {@link AcDbOpenDatabaseOptions.drawNoPlotLayers} when opening a database.
|
|
151
153
|
*/
|
|
152
154
|
_this._drawNoPlotLayers = true;
|
|
155
|
+
_this._eventBatchDepth = 0;
|
|
156
|
+
_this._pendingEntityModified = new Set();
|
|
157
|
+
_this._pendingEntityAppended = [];
|
|
158
|
+
_this._pendingEntityErased = [];
|
|
159
|
+
_this._pendingDictObjectSet = [];
|
|
160
|
+
_this._pendingDictObjectErased = [];
|
|
153
161
|
/**
|
|
154
162
|
* Events that can be triggered by the database.
|
|
155
163
|
*
|
|
@@ -229,6 +237,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
229
237
|
mlineStyle: new AcDbDictionary(_this),
|
|
230
238
|
xrecord: new AcDbDictionary(_this)
|
|
231
239
|
};
|
|
240
|
+
_this.transactionManager = new AcDbDatabaseTransactionManager(_this);
|
|
232
241
|
return _this;
|
|
233
242
|
}
|
|
234
243
|
Object.defineProperty(AcDbDatabase.prototype, "tables", {
|
|
@@ -268,6 +277,394 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
268
277
|
enumerable: false,
|
|
269
278
|
configurable: true
|
|
270
279
|
});
|
|
280
|
+
/**
|
|
281
|
+
* Looks up a database-resident object by its object ID.
|
|
282
|
+
*
|
|
283
|
+
* Search order: entities, symbol table records, dictionary objects
|
|
284
|
+
* (including nested dictionaries), then the database object itself.
|
|
285
|
+
*
|
|
286
|
+
* @param id - Object identifier to resolve
|
|
287
|
+
* @param _openErased - Reserved for erased-object support
|
|
288
|
+
* @returns The matching object, or undefined if not found
|
|
289
|
+
*/
|
|
290
|
+
AcDbDatabase.prototype.getObjectById = function (id, _openErased) {
|
|
291
|
+
var e_1, _a, e_2, _b;
|
|
292
|
+
if (_openErased === void 0) { _openErased = false; }
|
|
293
|
+
if (id === this.objectId) {
|
|
294
|
+
return this;
|
|
295
|
+
}
|
|
296
|
+
var entity = this.tables.blockTable.getEntityById(id);
|
|
297
|
+
if (entity) {
|
|
298
|
+
return entity;
|
|
299
|
+
}
|
|
300
|
+
var symbolTables = [
|
|
301
|
+
this.tables.appIdTable,
|
|
302
|
+
this.tables.blockTable,
|
|
303
|
+
this.tables.dimStyleTable,
|
|
304
|
+
this.tables.linetypeTable,
|
|
305
|
+
this.tables.textStyleTable,
|
|
306
|
+
this.tables.viewTable,
|
|
307
|
+
this.tables.layerTable,
|
|
308
|
+
this.tables.viewportTable
|
|
309
|
+
];
|
|
310
|
+
try {
|
|
311
|
+
for (var symbolTables_1 = __values(symbolTables), symbolTables_1_1 = symbolTables_1.next(); !symbolTables_1_1.done; symbolTables_1_1 = symbolTables_1.next()) {
|
|
312
|
+
var table = symbolTables_1_1.value;
|
|
313
|
+
var record = table.getIdAt(id);
|
|
314
|
+
if (record) {
|
|
315
|
+
return record;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
320
|
+
finally {
|
|
321
|
+
try {
|
|
322
|
+
if (symbolTables_1_1 && !symbolTables_1_1.done && (_a = symbolTables_1.return)) _a.call(symbolTables_1);
|
|
323
|
+
}
|
|
324
|
+
finally { if (e_1) throw e_1.error; }
|
|
325
|
+
}
|
|
326
|
+
try {
|
|
327
|
+
for (var _c = __values(this.getRootDictionaries()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
328
|
+
var dictionary = _d.value;
|
|
329
|
+
if (dictionary.objectId === id) {
|
|
330
|
+
return dictionary;
|
|
331
|
+
}
|
|
332
|
+
var object = this.findObjectInDictionary(dictionary, id);
|
|
333
|
+
if (object) {
|
|
334
|
+
return object;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
339
|
+
finally {
|
|
340
|
+
try {
|
|
341
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
342
|
+
}
|
|
343
|
+
finally { if (e_2) throw e_2.error; }
|
|
344
|
+
}
|
|
345
|
+
return undefined;
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* Returns true when the transaction manager is actively recording changes.
|
|
349
|
+
*
|
|
350
|
+
* Shortcut for {@link AcDbDatabaseTransactionManager.isRecording}.
|
|
351
|
+
*/
|
|
352
|
+
AcDbDatabase.prototype.isUndoRecording = function () {
|
|
353
|
+
return this.transactionManager.isRecording();
|
|
354
|
+
};
|
|
355
|
+
/**
|
|
356
|
+
* Opens a database object, preferring the active transaction when present.
|
|
357
|
+
*
|
|
358
|
+
* Editor shortcut: when a transaction is active, objects are opened through it
|
|
359
|
+
* so mutations are tracked for undo. Otherwise falls back to {@link getObjectById}.
|
|
360
|
+
*/
|
|
361
|
+
AcDbDatabase.prototype.openObject = function (objectId, mode) {
|
|
362
|
+
var tr = this.transactionManager.currentTransaction();
|
|
363
|
+
if (tr) {
|
|
364
|
+
var opened = tr.getObject(objectId, mode);
|
|
365
|
+
if (opened) {
|
|
366
|
+
return opened;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return this.getObjectById(objectId);
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* Opens a database object for read through the active transaction when present.
|
|
373
|
+
*
|
|
374
|
+
* Editor shortcut; see {@link openObject}.
|
|
375
|
+
*/
|
|
376
|
+
AcDbDatabase.prototype.openObjectForRead = function (objectId) {
|
|
377
|
+
return this.openObject(objectId, AcDbOpenMode.kForRead);
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Opens a database object for write through the active transaction when present.
|
|
381
|
+
*
|
|
382
|
+
* Editor shortcut; see {@link openObject}.
|
|
383
|
+
*/
|
|
384
|
+
AcDbDatabase.prototype.openObjectForWrite = function (objectId) {
|
|
385
|
+
return this.openObject(objectId, AcDbOpenMode.kForWrite);
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Opens an entity for read through the active transaction when present.
|
|
389
|
+
*
|
|
390
|
+
* Editor shortcut; see {@link openObject}.
|
|
391
|
+
*/
|
|
392
|
+
AcDbDatabase.prototype.openEntityForRead = function (entityOrId) {
|
|
393
|
+
var objectId = typeof entityOrId === 'string' ? entityOrId : entityOrId.objectId;
|
|
394
|
+
return this.openObjectForRead(objectId);
|
|
395
|
+
};
|
|
396
|
+
/**
|
|
397
|
+
* Opens an entity for write through the active transaction when present.
|
|
398
|
+
*
|
|
399
|
+
* Editor shortcut; see {@link openObject}.
|
|
400
|
+
*/
|
|
401
|
+
AcDbDatabase.prototype.openEntityForWrite = function (entityOrId) {
|
|
402
|
+
var objectId = typeof entityOrId === 'string' ? entityOrId : entityOrId.objectId;
|
|
403
|
+
return this.openObjectForWrite(objectId);
|
|
404
|
+
};
|
|
405
|
+
/**
|
|
406
|
+
* Runs a database mutation as one undoable operation.
|
|
407
|
+
*
|
|
408
|
+
* Editor shortcut: skips creating a new undo mark when the transaction manager
|
|
409
|
+
* is already recording (nested editor operations). Otherwise wraps `fn` in
|
|
410
|
+
* {@link AcDbDatabaseTransactionManager.runUndoable}.
|
|
411
|
+
*/
|
|
412
|
+
AcDbDatabase.prototype.runDatabaseEdit = function (label, fn) {
|
|
413
|
+
if (this.isUndoRecording()) {
|
|
414
|
+
fn();
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
this.transactionManager.runUndoable(label, fn);
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* Returns the top-level named object dictionaries owned by this database.
|
|
421
|
+
*/
|
|
422
|
+
AcDbDatabase.prototype.getRootDictionaries = function () {
|
|
423
|
+
return [
|
|
424
|
+
this.objects.dictionary,
|
|
425
|
+
this.objects.imageDefinition,
|
|
426
|
+
this.objects.layout,
|
|
427
|
+
this.objects.mleaderStyle,
|
|
428
|
+
this.objects.mlineStyle,
|
|
429
|
+
this.objects.xrecord
|
|
430
|
+
];
|
|
431
|
+
};
|
|
432
|
+
/**
|
|
433
|
+
* Recursively searches a dictionary tree for an object with the given ID.
|
|
434
|
+
*
|
|
435
|
+
* @param dictionary - Root dictionary to search (including nested dictionaries)
|
|
436
|
+
* @param id - Object identifier to resolve
|
|
437
|
+
* @returns Matching object, or undefined when not found under `dictionary`
|
|
438
|
+
*/
|
|
439
|
+
AcDbDatabase.prototype.findObjectInDictionary = function (dictionary, id) {
|
|
440
|
+
var e_3, _a;
|
|
441
|
+
if (dictionary.objectId === id) {
|
|
442
|
+
return dictionary;
|
|
443
|
+
}
|
|
444
|
+
var direct = dictionary.getIdAt(id);
|
|
445
|
+
if (direct) {
|
|
446
|
+
return direct;
|
|
447
|
+
}
|
|
448
|
+
try {
|
|
449
|
+
for (var _b = __values(dictionary.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
450
|
+
var _d = __read(_c.value, 2), entry = _d[1];
|
|
451
|
+
if (entry.objectId === id) {
|
|
452
|
+
return entry;
|
|
453
|
+
}
|
|
454
|
+
if (entry instanceof AcDbDictionary) {
|
|
455
|
+
var nested = this.findObjectInDictionary(entry, id);
|
|
456
|
+
if (nested) {
|
|
457
|
+
return nested;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
463
|
+
finally {
|
|
464
|
+
try {
|
|
465
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
466
|
+
}
|
|
467
|
+
finally { if (e_3) throw e_3.error; }
|
|
468
|
+
}
|
|
469
|
+
return undefined;
|
|
470
|
+
};
|
|
471
|
+
/**
|
|
472
|
+
* Begins suppressing database events until {@link endEventBatch} is called.
|
|
473
|
+
*/
|
|
474
|
+
AcDbDatabase.prototype.beginEventBatch = function () {
|
|
475
|
+
this._eventBatchDepth++;
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* Ends event batching and dispatches accumulated entity events when the outermost batch closes.
|
|
479
|
+
*/
|
|
480
|
+
AcDbDatabase.prototype.endEventBatch = function () {
|
|
481
|
+
if (this._eventBatchDepth <= 0) {
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
this._eventBatchDepth--;
|
|
485
|
+
if (this._eventBatchDepth === 0) {
|
|
486
|
+
this.flushEventBatch();
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
/**
|
|
490
|
+
* Returns true when database events are being batched.
|
|
491
|
+
*/
|
|
492
|
+
AcDbDatabase.prototype.isEventBatched = function () {
|
|
493
|
+
return this._eventBatchDepth > 0;
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* Dispatches or queues an entity-modified notification.
|
|
497
|
+
*
|
|
498
|
+
* When {@link isEventBatched} is true, the entity is deduplicated in a pending set
|
|
499
|
+
* and dispatched from {@link flushEventBatch} when the outermost batch closes.
|
|
500
|
+
*
|
|
501
|
+
* @param entity - Entity whose properties changed
|
|
502
|
+
*/
|
|
503
|
+
AcDbDatabase.prototype.notifyEntityModified = function (entity) {
|
|
504
|
+
if (this.isEventBatched()) {
|
|
505
|
+
this._pendingEntityModified.add(entity);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
this.events.entityModified.dispatch({
|
|
509
|
+
database: this,
|
|
510
|
+
entity: entity
|
|
511
|
+
});
|
|
512
|
+
};
|
|
513
|
+
/**
|
|
514
|
+
* Dispatches or queues an entity-appended notification.
|
|
515
|
+
*
|
|
516
|
+
* @param entity - One entity or batch of entities added to model/paper space
|
|
517
|
+
*/
|
|
518
|
+
AcDbDatabase.prototype.notifyEntityAppended = function (entity) {
|
|
519
|
+
var _a;
|
|
520
|
+
if (this.isEventBatched()) {
|
|
521
|
+
var items = Array.isArray(entity) ? entity : [entity];
|
|
522
|
+
(_a = this._pendingEntityAppended).push.apply(_a, __spreadArray([], __read(items), false));
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
this.events.entityAppended.dispatch({
|
|
526
|
+
database: this,
|
|
527
|
+
entity: entity
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
/**
|
|
531
|
+
* Dispatches or queues an entity-erased notification.
|
|
532
|
+
*
|
|
533
|
+
* @param entity - One entity or batch of entities removed from model/paper space
|
|
534
|
+
*/
|
|
535
|
+
AcDbDatabase.prototype.notifyEntityErased = function (entity) {
|
|
536
|
+
var _a;
|
|
537
|
+
if (this.isEventBatched()) {
|
|
538
|
+
var items = Array.isArray(entity) ? entity : [entity];
|
|
539
|
+
(_a = this._pendingEntityErased).push.apply(_a, __spreadArray([], __read(items), false));
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
this.events.entityErased.dispatch({
|
|
543
|
+
database: this,
|
|
544
|
+
entity: entity
|
|
545
|
+
});
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* Dispatches or queues a dictionary-object-set notification.
|
|
549
|
+
*
|
|
550
|
+
* @param object - Object inserted or replaced in a named dictionary
|
|
551
|
+
* @param key - Dictionary key under which the object is stored
|
|
552
|
+
*/
|
|
553
|
+
AcDbDatabase.prototype.notifyDictObjectSet = function (object, key) {
|
|
554
|
+
if (this.isEventBatched()) {
|
|
555
|
+
this._pendingDictObjectSet.push({ object: object, key: key });
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
this.events.dictObjetSet.dispatch({
|
|
559
|
+
database: this,
|
|
560
|
+
object: object,
|
|
561
|
+
key: key
|
|
562
|
+
});
|
|
563
|
+
};
|
|
564
|
+
/**
|
|
565
|
+
* Dispatches or queues a dictionary-object-erased notification.
|
|
566
|
+
*
|
|
567
|
+
* @param object - Object removed from a named dictionary
|
|
568
|
+
* @param key - Dictionary key that previously referenced the object
|
|
569
|
+
*/
|
|
570
|
+
AcDbDatabase.prototype.notifyDictObjectErased = function (object, key) {
|
|
571
|
+
if (this.isEventBatched()) {
|
|
572
|
+
this._pendingDictObjectErased.push({ object: object, key: key });
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
this.events.dictObjectErased.dispatch({
|
|
576
|
+
database: this,
|
|
577
|
+
object: object,
|
|
578
|
+
key: key
|
|
579
|
+
});
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* Dispatches all notifications accumulated while event batching was active.
|
|
583
|
+
*
|
|
584
|
+
* Entity-modified events are deduplicated by entity; appended and erased
|
|
585
|
+
* entities are dispatched in batch arrays where applicable.
|
|
586
|
+
*/
|
|
587
|
+
AcDbDatabase.prototype.flushEventBatch = function () {
|
|
588
|
+
var e_4, _a, e_5, _b, e_6, _c;
|
|
589
|
+
if (this._pendingEntityModified.size > 0) {
|
|
590
|
+
var modified = __spreadArray([], __read(this._pendingEntityModified), false);
|
|
591
|
+
this._pendingEntityModified.clear();
|
|
592
|
+
try {
|
|
593
|
+
for (var modified_1 = __values(modified), modified_1_1 = modified_1.next(); !modified_1_1.done; modified_1_1 = modified_1.next()) {
|
|
594
|
+
var entity = modified_1_1.value;
|
|
595
|
+
this.events.entityModified.dispatch({
|
|
596
|
+
database: this,
|
|
597
|
+
entity: entity
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
602
|
+
finally {
|
|
603
|
+
try {
|
|
604
|
+
if (modified_1_1 && !modified_1_1.done && (_a = modified_1.return)) _a.call(modified_1);
|
|
605
|
+
}
|
|
606
|
+
finally { if (e_4) throw e_4.error; }
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
if (this._pendingEntityAppended.length > 0) {
|
|
610
|
+
var appended = this._pendingEntityAppended;
|
|
611
|
+
this._pendingEntityAppended = [];
|
|
612
|
+
this.events.entityAppended.dispatch({
|
|
613
|
+
database: this,
|
|
614
|
+
entity: appended
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
if (this._pendingEntityErased.length > 0) {
|
|
618
|
+
var erased = this._pendingEntityErased;
|
|
619
|
+
this._pendingEntityErased = [];
|
|
620
|
+
this.events.entityErased.dispatch({
|
|
621
|
+
database: this,
|
|
622
|
+
entity: erased
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
if (this._pendingDictObjectSet.length > 0) {
|
|
626
|
+
var dictSet = this._pendingDictObjectSet;
|
|
627
|
+
this._pendingDictObjectSet = [];
|
|
628
|
+
try {
|
|
629
|
+
for (var dictSet_1 = __values(dictSet), dictSet_1_1 = dictSet_1.next(); !dictSet_1_1.done; dictSet_1_1 = dictSet_1.next()) {
|
|
630
|
+
var _d = dictSet_1_1.value, object = _d.object, key = _d.key;
|
|
631
|
+
this.events.dictObjetSet.dispatch({
|
|
632
|
+
database: this,
|
|
633
|
+
object: object,
|
|
634
|
+
key: key
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
639
|
+
finally {
|
|
640
|
+
try {
|
|
641
|
+
if (dictSet_1_1 && !dictSet_1_1.done && (_b = dictSet_1.return)) _b.call(dictSet_1);
|
|
642
|
+
}
|
|
643
|
+
finally { if (e_5) throw e_5.error; }
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
if (this._pendingDictObjectErased.length > 0) {
|
|
647
|
+
var dictErased = this._pendingDictObjectErased;
|
|
648
|
+
this._pendingDictObjectErased = [];
|
|
649
|
+
try {
|
|
650
|
+
for (var dictErased_1 = __values(dictErased), dictErased_1_1 = dictErased_1.next(); !dictErased_1_1.done; dictErased_1_1 = dictErased_1.next()) {
|
|
651
|
+
var _e = dictErased_1_1.value, object = _e.object, key = _e.key;
|
|
652
|
+
this.events.dictObjectErased.dispatch({
|
|
653
|
+
database: this,
|
|
654
|
+
object: object,
|
|
655
|
+
key: key
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
660
|
+
finally {
|
|
661
|
+
try {
|
|
662
|
+
if (dictErased_1_1 && !dictErased_1_1.done && (_c = dictErased_1.return)) _c.call(dictErased_1);
|
|
663
|
+
}
|
|
664
|
+
finally { if (e_6) throw e_6.error; }
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
};
|
|
271
668
|
Object.defineProperty(AcDbDatabase.prototype, "formatter", {
|
|
272
669
|
/**
|
|
273
670
|
* Formatter for linear distances, point coordinates, and angles using this database's
|
|
@@ -1227,7 +1624,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1227
1624
|
AcDbDatabase.prototype.openUri = function (url, options) {
|
|
1228
1625
|
return __awaiter(this, void 0, void 0, function () {
|
|
1229
1626
|
var response, contentLength, totalBytes, loadedBytes, reader, chunks, _a, done, value, percentage, content, position, chunks_1, chunks_1_1, chunk, fileName, fileExtension;
|
|
1230
|
-
var
|
|
1627
|
+
var e_7, _b;
|
|
1231
1628
|
var _c;
|
|
1232
1629
|
return __generator(this, function (_d) {
|
|
1233
1630
|
switch (_d.label) {
|
|
@@ -1290,12 +1687,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1290
1687
|
position += chunk.length;
|
|
1291
1688
|
}
|
|
1292
1689
|
}
|
|
1293
|
-
catch (
|
|
1690
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1294
1691
|
finally {
|
|
1295
1692
|
try {
|
|
1296
1693
|
if (chunks_1_1 && !chunks_1_1.done && (_b = chunks_1.return)) _b.call(chunks_1);
|
|
1297
1694
|
}
|
|
1298
|
-
finally { if (
|
|
1695
|
+
finally { if (e_7) throw e_7.error; }
|
|
1299
1696
|
}
|
|
1300
1697
|
fileName = this.getFileNameFromUri(url);
|
|
1301
1698
|
if (fileName) {
|
|
@@ -1480,7 +1877,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1480
1877
|
}));
|
|
1481
1878
|
};
|
|
1482
1879
|
AcDbDatabase.prototype.hasDefaultTextStyle = function () {
|
|
1483
|
-
var
|
|
1880
|
+
var e_8, _a, e_9, _b;
|
|
1484
1881
|
var defaultNames = [DEFAULT_TEXT_STYLE, 'STANDARD'];
|
|
1485
1882
|
try {
|
|
1486
1883
|
for (var defaultNames_1 = __values(defaultNames), defaultNames_1_1 = defaultNames_1.next(); !defaultNames_1_1.done; defaultNames_1_1 = defaultNames_1.next()) {
|
|
@@ -1490,12 +1887,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1490
1887
|
}
|
|
1491
1888
|
}
|
|
1492
1889
|
}
|
|
1493
|
-
catch (
|
|
1890
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1494
1891
|
finally {
|
|
1495
1892
|
try {
|
|
1496
1893
|
if (defaultNames_1_1 && !defaultNames_1_1.done && (_a = defaultNames_1.return)) _a.call(defaultNames_1);
|
|
1497
1894
|
}
|
|
1498
|
-
finally { if (
|
|
1895
|
+
finally { if (e_8) throw e_8.error; }
|
|
1499
1896
|
}
|
|
1500
1897
|
try {
|
|
1501
1898
|
for (var _c = __values(this.tables.textStyleTable.newIterator()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -1505,12 +1902,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1505
1902
|
}
|
|
1506
1903
|
}
|
|
1507
1904
|
}
|
|
1508
|
-
catch (
|
|
1905
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1509
1906
|
finally {
|
|
1510
1907
|
try {
|
|
1511
1908
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1512
1909
|
}
|
|
1513
|
-
finally { if (
|
|
1910
|
+
finally { if (e_9) throw e_9.error; }
|
|
1514
1911
|
}
|
|
1515
1912
|
return false;
|
|
1516
1913
|
};
|
|
@@ -1597,7 +1994,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1597
1994
|
* Ensures one MLINE style exists for the provided style name.
|
|
1598
1995
|
*/
|
|
1599
1996
|
AcDbDatabase.prototype.ensureMLineStyle = function (styleName) {
|
|
1600
|
-
var
|
|
1997
|
+
var e_10, _a;
|
|
1601
1998
|
var dictionary = this.objects.mlineStyle;
|
|
1602
1999
|
var normalizedName = styleName.trim();
|
|
1603
2000
|
if (!normalizedName)
|
|
@@ -1614,12 +2011,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1614
2011
|
}
|
|
1615
2012
|
}
|
|
1616
2013
|
}
|
|
1617
|
-
catch (
|
|
2014
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1618
2015
|
finally {
|
|
1619
2016
|
try {
|
|
1620
2017
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1621
2018
|
}
|
|
1622
|
-
finally { if (
|
|
2019
|
+
finally { if (e_10) throw e_10.error; }
|
|
1623
2020
|
}
|
|
1624
2021
|
var style = new AcDbMlineStyle();
|
|
1625
2022
|
style.styleName = normalizedName;
|
|
@@ -1641,7 +2038,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1641
2038
|
* Ensures one MLEADER style exists for the provided style name.
|
|
1642
2039
|
*/
|
|
1643
2040
|
AcDbDatabase.prototype.ensureMLeaderStyle = function (styleName) {
|
|
1644
|
-
var
|
|
2041
|
+
var e_11, _a;
|
|
1645
2042
|
var dictionary = this.objects.mleaderStyle;
|
|
1646
2043
|
var normalizedName = styleName.trim();
|
|
1647
2044
|
if (!normalizedName)
|
|
@@ -1657,12 +2054,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1657
2054
|
}
|
|
1658
2055
|
}
|
|
1659
2056
|
}
|
|
1660
|
-
catch (
|
|
2057
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1661
2058
|
finally {
|
|
1662
2059
|
try {
|
|
1663
2060
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1664
2061
|
}
|
|
1665
|
-
finally { if (
|
|
2062
|
+
finally { if (e_11) throw e_11.error; }
|
|
1666
2063
|
}
|
|
1667
2064
|
var style = new AcDbMLeaderStyle();
|
|
1668
2065
|
// Match AutoCAD "Standard" defaults observed in exported DXF.
|
|
@@ -1789,7 +2186,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1789
2186
|
* @param filer - DXF output writer.
|
|
1790
2187
|
*/
|
|
1791
2188
|
AcDbDatabase.prototype.writeDxfBlocksSection = function (filer) {
|
|
1792
|
-
var
|
|
2189
|
+
var e_12, _a, e_13, _b;
|
|
1793
2190
|
filer.startSection('BLOCKS');
|
|
1794
2191
|
try {
|
|
1795
2192
|
for (var _c = __values(this.tables.blockTable.newIterator()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -1797,28 +2194,28 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1797
2194
|
btr.dxfOutBlockBegin(filer);
|
|
1798
2195
|
if (!btr.isModelSapce && !btr.isPaperSapce) {
|
|
1799
2196
|
try {
|
|
1800
|
-
for (var _e = (
|
|
2197
|
+
for (var _e = (e_13 = void 0, __values(btr.newIterator())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1801
2198
|
var entity = _f.value;
|
|
1802
2199
|
this.writeDxfEntity(filer, entity);
|
|
1803
2200
|
}
|
|
1804
2201
|
}
|
|
1805
|
-
catch (
|
|
2202
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1806
2203
|
finally {
|
|
1807
2204
|
try {
|
|
1808
2205
|
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1809
2206
|
}
|
|
1810
|
-
finally { if (
|
|
2207
|
+
finally { if (e_13) throw e_13.error; }
|
|
1811
2208
|
}
|
|
1812
2209
|
}
|
|
1813
2210
|
btr.dxfOutBlockEnd(filer);
|
|
1814
2211
|
}
|
|
1815
2212
|
}
|
|
1816
|
-
catch (
|
|
2213
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1817
2214
|
finally {
|
|
1818
2215
|
try {
|
|
1819
2216
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1820
2217
|
}
|
|
1821
|
-
finally { if (
|
|
2218
|
+
finally { if (e_12) throw e_12.error; }
|
|
1822
2219
|
}
|
|
1823
2220
|
filer.endSection();
|
|
1824
2221
|
};
|
|
@@ -1828,7 +2225,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1828
2225
|
* @param filer - DXF output writer.
|
|
1829
2226
|
*/
|
|
1830
2227
|
AcDbDatabase.prototype.writeDxfEntitiesSection = function (filer) {
|
|
1831
|
-
var
|
|
2228
|
+
var e_14, _a, e_15, _b;
|
|
1832
2229
|
filer.startSection('ENTITIES');
|
|
1833
2230
|
try {
|
|
1834
2231
|
for (var _c = __values(this.tables.blockTable.newIterator()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -1836,26 +2233,26 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1836
2233
|
if (!btr.isModelSapce && !btr.isPaperSapce)
|
|
1837
2234
|
continue;
|
|
1838
2235
|
try {
|
|
1839
|
-
for (var _e = (
|
|
2236
|
+
for (var _e = (e_15 = void 0, __values(btr.newIterator())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1840
2237
|
var entity = _f.value;
|
|
1841
2238
|
this.writeDxfEntity(filer, entity);
|
|
1842
2239
|
}
|
|
1843
2240
|
}
|
|
1844
|
-
catch (
|
|
2241
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1845
2242
|
finally {
|
|
1846
2243
|
try {
|
|
1847
2244
|
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1848
2245
|
}
|
|
1849
|
-
finally { if (
|
|
2246
|
+
finally { if (e_15) throw e_15.error; }
|
|
1850
2247
|
}
|
|
1851
2248
|
}
|
|
1852
2249
|
}
|
|
1853
|
-
catch (
|
|
2250
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1854
2251
|
finally {
|
|
1855
2252
|
try {
|
|
1856
2253
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1857
2254
|
}
|
|
1858
|
-
finally { if (
|
|
2255
|
+
finally { if (e_14) throw e_14.error; }
|
|
1859
2256
|
}
|
|
1860
2257
|
filer.endSection();
|
|
1861
2258
|
};
|
|
@@ -1865,7 +2262,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1865
2262
|
* @param filer - DXF output writer.
|
|
1866
2263
|
*/
|
|
1867
2264
|
AcDbDatabase.prototype.writeDxfObjectsSection = function (filer) {
|
|
1868
|
-
var
|
|
2265
|
+
var e_16, _a, e_17, _b, e_18, _c, e_19, _d, e_20, _e;
|
|
1869
2266
|
filer.startSection('OBJECTS');
|
|
1870
2267
|
var rootDict = this.objects.dictionary;
|
|
1871
2268
|
rootDict.ownerId = '0';
|
|
@@ -1930,12 +2327,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1930
2327
|
layout.dxfOut(filer);
|
|
1931
2328
|
}
|
|
1932
2329
|
}
|
|
1933
|
-
catch (
|
|
2330
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
1934
2331
|
finally {
|
|
1935
2332
|
try {
|
|
1936
2333
|
if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
|
|
1937
2334
|
}
|
|
1938
|
-
finally { if (
|
|
2335
|
+
finally { if (e_16) throw e_16.error; }
|
|
1939
2336
|
}
|
|
1940
2337
|
try {
|
|
1941
2338
|
for (var _j = __values(this.objects.imageDefinition.entries()), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
@@ -1944,12 +2341,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1944
2341
|
imageDef.dxfOut(filer);
|
|
1945
2342
|
}
|
|
1946
2343
|
}
|
|
1947
|
-
catch (
|
|
2344
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
1948
2345
|
finally {
|
|
1949
2346
|
try {
|
|
1950
2347
|
if (_k && !_k.done && (_b = _j.return)) _b.call(_j);
|
|
1951
2348
|
}
|
|
1952
|
-
finally { if (
|
|
2349
|
+
finally { if (e_17) throw e_17.error; }
|
|
1953
2350
|
}
|
|
1954
2351
|
try {
|
|
1955
2352
|
for (var _m = __values(this.objects.mleaderStyle.entries()), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
@@ -1958,12 +2355,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1958
2355
|
mleaderStyle.dxfOut(filer);
|
|
1959
2356
|
}
|
|
1960
2357
|
}
|
|
1961
|
-
catch (
|
|
2358
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
1962
2359
|
finally {
|
|
1963
2360
|
try {
|
|
1964
2361
|
if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
|
|
1965
2362
|
}
|
|
1966
|
-
finally { if (
|
|
2363
|
+
finally { if (e_18) throw e_18.error; }
|
|
1967
2364
|
}
|
|
1968
2365
|
try {
|
|
1969
2366
|
for (var _q = __values(this.objects.mlineStyle.entries()), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
@@ -1972,12 +2369,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1972
2369
|
mlineStyle.dxfOut(filer);
|
|
1973
2370
|
}
|
|
1974
2371
|
}
|
|
1975
|
-
catch (
|
|
2372
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
1976
2373
|
finally {
|
|
1977
2374
|
try {
|
|
1978
2375
|
if (_r && !_r.done && (_d = _q.return)) _d.call(_q);
|
|
1979
2376
|
}
|
|
1980
|
-
finally { if (
|
|
2377
|
+
finally { if (e_19) throw e_19.error; }
|
|
1981
2378
|
}
|
|
1982
2379
|
try {
|
|
1983
2380
|
for (var _t = __values(this.objects.xrecord.entries()), _u = _t.next(); !_u.done; _u = _t.next()) {
|
|
@@ -1986,12 +2383,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1986
2383
|
xrecord.dxfOut(filer);
|
|
1987
2384
|
}
|
|
1988
2385
|
}
|
|
1989
|
-
catch (
|
|
2386
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
1990
2387
|
finally {
|
|
1991
2388
|
try {
|
|
1992
2389
|
if (_u && !_u.done && (_e = _t.return)) _e.call(_t);
|
|
1993
2390
|
}
|
|
1994
|
-
finally { if (
|
|
2391
|
+
finally { if (e_20) throw e_20.error; }
|
|
1995
2392
|
}
|
|
1996
2393
|
filer.endSection();
|
|
1997
2394
|
};
|
|
@@ -2005,7 +2402,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
2005
2402
|
* @param recordType - DXF record type name for each table record.
|
|
2006
2403
|
*/
|
|
2007
2404
|
AcDbDatabase.prototype.writeDxfTable = function (filer, tableName, table, records, recordType) {
|
|
2008
|
-
var
|
|
2405
|
+
var e_21, _a;
|
|
2009
2406
|
var items = __spreadArray([], __read(records), false);
|
|
2010
2407
|
filer.startTable(tableName);
|
|
2011
2408
|
table.dxfOut(filer);
|
|
@@ -2021,12 +2418,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
2021
2418
|
record.dxfOut(filer);
|
|
2022
2419
|
}
|
|
2023
2420
|
}
|
|
2024
|
-
catch (
|
|
2421
|
+
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
2025
2422
|
finally {
|
|
2026
2423
|
try {
|
|
2027
2424
|
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
|
|
2028
2425
|
}
|
|
2029
|
-
finally { if (
|
|
2426
|
+
finally { if (e_21) throw e_21.error; }
|
|
2030
2427
|
}
|
|
2031
2428
|
filer.endTable();
|
|
2032
2429
|
};
|
|
@@ -2056,6 +2453,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
2056
2453
|
* ```
|
|
2057
2454
|
*/
|
|
2058
2455
|
AcDbDatabase.prototype.clear = function () {
|
|
2456
|
+
this.transactionManager.clearUndoStack();
|
|
2059
2457
|
// Clear all tables and dictionaries
|
|
2060
2458
|
this._tables.blockTable.removeAll();
|
|
2061
2459
|
this._tables.dimStyleTable.removeAll();
|
|
@@ -2076,28 +2474,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
2076
2474
|
* Updates a sysvar value and dispatches the change event only when the value changed.
|
|
2077
2475
|
*/
|
|
2078
2476
|
AcDbDatabase.prototype.updateSysVar = function (sysVarName, currentValue, nextValue, setter) {
|
|
2079
|
-
|
|
2080
|
-
return;
|
|
2081
|
-
}
|
|
2082
|
-
setter(nextValue);
|
|
2083
|
-
this.triggerSysVarChangedEvent(sysVarName, currentValue, nextValue);
|
|
2084
|
-
};
|
|
2085
|
-
/**
|
|
2086
|
-
* Determines whether two sysvar values are different.
|
|
2087
|
-
*/
|
|
2088
|
-
AcDbDatabase.prototype.hasSysVarValueChanged = function (currentValue, nextValue) {
|
|
2089
|
-
if (currentValue instanceof AcCmColor && nextValue instanceof AcCmColor) {
|
|
2090
|
-
return !currentValue.equals(nextValue);
|
|
2091
|
-
}
|
|
2092
|
-
if (currentValue instanceof AcCmTransparency &&
|
|
2093
|
-
nextValue instanceof AcCmTransparency) {
|
|
2094
|
-
return !currentValue.equals(nextValue);
|
|
2095
|
-
}
|
|
2096
|
-
if (currentValue instanceof AcDbDwgVersion &&
|
|
2097
|
-
nextValue instanceof AcDbDwgVersion) {
|
|
2098
|
-
return currentValue.value !== nextValue.value;
|
|
2099
|
-
}
|
|
2100
|
-
return !Object.is(currentValue, nextValue);
|
|
2477
|
+
AcDbSysVarManager.instance().applyVarMutation(sysVarName, currentValue, nextValue, this, function () { return setter(nextValue); });
|
|
2101
2478
|
};
|
|
2102
2479
|
/**
|
|
2103
2480
|
* Normalizes special linetype aliases to the internal canonical names.
|