@mlightcad/data-model 1.9.10 → 1.9.11
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 +86 -4
- package/lib/database/AcDbDatabase.d.ts.map +1 -1
- package/lib/database/AcDbDatabase.js +366 -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
|
@@ -122,6 +122,7 @@ import { AcDbSysVarManager } from './AcDbSysVarManager';
|
|
|
122
122
|
import { AcDbSystemVariables } from './AcDbSystemVariables';
|
|
123
123
|
import { AcDbLayout } from '../object/layout/AcDbLayout';
|
|
124
124
|
import { AcDbLayoutDictionary } from '../object/layout/AcDbLayoutDictionary';
|
|
125
|
+
import { AcDbDatabaseTransactionManager } from './transaction/AcDbDatabaseTransactionManager';
|
|
125
126
|
/**
|
|
126
127
|
* The AcDbDatabase class represents an AutoCAD drawing file.
|
|
127
128
|
*
|
|
@@ -150,6 +151,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
150
151
|
* Set from {@link AcDbOpenDatabaseOptions.drawNoPlotLayers} when opening a database.
|
|
151
152
|
*/
|
|
152
153
|
_this._drawNoPlotLayers = true;
|
|
154
|
+
_this._eventBatchDepth = 0;
|
|
155
|
+
_this._pendingEntityModified = new Set();
|
|
156
|
+
_this._pendingEntityAppended = [];
|
|
157
|
+
_this._pendingEntityErased = [];
|
|
158
|
+
_this._pendingDictObjectSet = [];
|
|
159
|
+
_this._pendingDictObjectErased = [];
|
|
153
160
|
/**
|
|
154
161
|
* Events that can be triggered by the database.
|
|
155
162
|
*
|
|
@@ -229,6 +236,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
229
236
|
mlineStyle: new AcDbDictionary(_this),
|
|
230
237
|
xrecord: new AcDbDictionary(_this)
|
|
231
238
|
};
|
|
239
|
+
_this.transactionManager = new AcDbDatabaseTransactionManager(_this);
|
|
232
240
|
return _this;
|
|
233
241
|
}
|
|
234
242
|
Object.defineProperty(AcDbDatabase.prototype, "tables", {
|
|
@@ -268,6 +276,322 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
268
276
|
enumerable: false,
|
|
269
277
|
configurable: true
|
|
270
278
|
});
|
|
279
|
+
/**
|
|
280
|
+
* Looks up a database-resident object by its object ID.
|
|
281
|
+
*
|
|
282
|
+
* Search order: entities, symbol table records, dictionary objects
|
|
283
|
+
* (including nested dictionaries), then the database object itself.
|
|
284
|
+
*
|
|
285
|
+
* @param id - Object identifier to resolve
|
|
286
|
+
* @param _openErased - Reserved for erased-object support
|
|
287
|
+
* @returns The matching object, or undefined if not found
|
|
288
|
+
*/
|
|
289
|
+
AcDbDatabase.prototype.getObjectById = function (id, _openErased) {
|
|
290
|
+
var e_1, _a, e_2, _b;
|
|
291
|
+
if (_openErased === void 0) { _openErased = false; }
|
|
292
|
+
if (id === this.objectId) {
|
|
293
|
+
return this;
|
|
294
|
+
}
|
|
295
|
+
var entity = this.tables.blockTable.getEntityById(id);
|
|
296
|
+
if (entity) {
|
|
297
|
+
return entity;
|
|
298
|
+
}
|
|
299
|
+
var symbolTables = [
|
|
300
|
+
this.tables.appIdTable,
|
|
301
|
+
this.tables.blockTable,
|
|
302
|
+
this.tables.dimStyleTable,
|
|
303
|
+
this.tables.linetypeTable,
|
|
304
|
+
this.tables.textStyleTable,
|
|
305
|
+
this.tables.viewTable,
|
|
306
|
+
this.tables.layerTable,
|
|
307
|
+
this.tables.viewportTable
|
|
308
|
+
];
|
|
309
|
+
try {
|
|
310
|
+
for (var symbolTables_1 = __values(symbolTables), symbolTables_1_1 = symbolTables_1.next(); !symbolTables_1_1.done; symbolTables_1_1 = symbolTables_1.next()) {
|
|
311
|
+
var table = symbolTables_1_1.value;
|
|
312
|
+
var record = table.getIdAt(id);
|
|
313
|
+
if (record) {
|
|
314
|
+
return record;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
319
|
+
finally {
|
|
320
|
+
try {
|
|
321
|
+
if (symbolTables_1_1 && !symbolTables_1_1.done && (_a = symbolTables_1.return)) _a.call(symbolTables_1);
|
|
322
|
+
}
|
|
323
|
+
finally { if (e_1) throw e_1.error; }
|
|
324
|
+
}
|
|
325
|
+
try {
|
|
326
|
+
for (var _c = __values(this.getRootDictionaries()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
327
|
+
var dictionary = _d.value;
|
|
328
|
+
if (dictionary.objectId === id) {
|
|
329
|
+
return dictionary;
|
|
330
|
+
}
|
|
331
|
+
var object = this.findObjectInDictionary(dictionary, id);
|
|
332
|
+
if (object) {
|
|
333
|
+
return object;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
338
|
+
finally {
|
|
339
|
+
try {
|
|
340
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
341
|
+
}
|
|
342
|
+
finally { if (e_2) throw e_2.error; }
|
|
343
|
+
}
|
|
344
|
+
return undefined;
|
|
345
|
+
};
|
|
346
|
+
/**
|
|
347
|
+
* Returns the top-level named object dictionaries owned by this database.
|
|
348
|
+
*/
|
|
349
|
+
AcDbDatabase.prototype.getRootDictionaries = function () {
|
|
350
|
+
return [
|
|
351
|
+
this.objects.dictionary,
|
|
352
|
+
this.objects.imageDefinition,
|
|
353
|
+
this.objects.layout,
|
|
354
|
+
this.objects.mleaderStyle,
|
|
355
|
+
this.objects.mlineStyle,
|
|
356
|
+
this.objects.xrecord
|
|
357
|
+
];
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* Recursively searches a dictionary tree for an object with the given ID.
|
|
361
|
+
*
|
|
362
|
+
* @param dictionary - Root dictionary to search (including nested dictionaries)
|
|
363
|
+
* @param id - Object identifier to resolve
|
|
364
|
+
* @returns Matching object, or undefined when not found under `dictionary`
|
|
365
|
+
*/
|
|
366
|
+
AcDbDatabase.prototype.findObjectInDictionary = function (dictionary, id) {
|
|
367
|
+
var e_3, _a;
|
|
368
|
+
if (dictionary.objectId === id) {
|
|
369
|
+
return dictionary;
|
|
370
|
+
}
|
|
371
|
+
var direct = dictionary.getIdAt(id);
|
|
372
|
+
if (direct) {
|
|
373
|
+
return direct;
|
|
374
|
+
}
|
|
375
|
+
try {
|
|
376
|
+
for (var _b = __values(dictionary.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
377
|
+
var _d = __read(_c.value, 2), entry = _d[1];
|
|
378
|
+
if (entry.objectId === id) {
|
|
379
|
+
return entry;
|
|
380
|
+
}
|
|
381
|
+
if (entry instanceof AcDbDictionary) {
|
|
382
|
+
var nested = this.findObjectInDictionary(entry, id);
|
|
383
|
+
if (nested) {
|
|
384
|
+
return nested;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
390
|
+
finally {
|
|
391
|
+
try {
|
|
392
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
393
|
+
}
|
|
394
|
+
finally { if (e_3) throw e_3.error; }
|
|
395
|
+
}
|
|
396
|
+
return undefined;
|
|
397
|
+
};
|
|
398
|
+
/**
|
|
399
|
+
* Begins suppressing database events until {@link endEventBatch} is called.
|
|
400
|
+
*/
|
|
401
|
+
AcDbDatabase.prototype.beginEventBatch = function () {
|
|
402
|
+
this._eventBatchDepth++;
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* Ends event batching and dispatches accumulated entity events when the outermost batch closes.
|
|
406
|
+
*/
|
|
407
|
+
AcDbDatabase.prototype.endEventBatch = function () {
|
|
408
|
+
if (this._eventBatchDepth <= 0) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
this._eventBatchDepth--;
|
|
412
|
+
if (this._eventBatchDepth === 0) {
|
|
413
|
+
this.flushEventBatch();
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* Returns true when database events are being batched.
|
|
418
|
+
*/
|
|
419
|
+
AcDbDatabase.prototype.isEventBatched = function () {
|
|
420
|
+
return this._eventBatchDepth > 0;
|
|
421
|
+
};
|
|
422
|
+
/**
|
|
423
|
+
* Dispatches or queues an entity-modified notification.
|
|
424
|
+
*
|
|
425
|
+
* When {@link isEventBatched} is true, the entity is deduplicated in a pending set
|
|
426
|
+
* and dispatched from {@link flushEventBatch} when the outermost batch closes.
|
|
427
|
+
*
|
|
428
|
+
* @param entity - Entity whose properties changed
|
|
429
|
+
*/
|
|
430
|
+
AcDbDatabase.prototype.notifyEntityModified = function (entity) {
|
|
431
|
+
if (this.isEventBatched()) {
|
|
432
|
+
this._pendingEntityModified.add(entity);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
this.events.entityModified.dispatch({
|
|
436
|
+
database: this,
|
|
437
|
+
entity: entity
|
|
438
|
+
});
|
|
439
|
+
};
|
|
440
|
+
/**
|
|
441
|
+
* Dispatches or queues an entity-appended notification.
|
|
442
|
+
*
|
|
443
|
+
* @param entity - One entity or batch of entities added to model/paper space
|
|
444
|
+
*/
|
|
445
|
+
AcDbDatabase.prototype.notifyEntityAppended = function (entity) {
|
|
446
|
+
var _a;
|
|
447
|
+
if (this.isEventBatched()) {
|
|
448
|
+
var items = Array.isArray(entity) ? entity : [entity];
|
|
449
|
+
(_a = this._pendingEntityAppended).push.apply(_a, __spreadArray([], __read(items), false));
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
this.events.entityAppended.dispatch({
|
|
453
|
+
database: this,
|
|
454
|
+
entity: entity
|
|
455
|
+
});
|
|
456
|
+
};
|
|
457
|
+
/**
|
|
458
|
+
* Dispatches or queues an entity-erased notification.
|
|
459
|
+
*
|
|
460
|
+
* @param entity - One entity or batch of entities removed from model/paper space
|
|
461
|
+
*/
|
|
462
|
+
AcDbDatabase.prototype.notifyEntityErased = function (entity) {
|
|
463
|
+
var _a;
|
|
464
|
+
if (this.isEventBatched()) {
|
|
465
|
+
var items = Array.isArray(entity) ? entity : [entity];
|
|
466
|
+
(_a = this._pendingEntityErased).push.apply(_a, __spreadArray([], __read(items), false));
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
this.events.entityErased.dispatch({
|
|
470
|
+
database: this,
|
|
471
|
+
entity: entity
|
|
472
|
+
});
|
|
473
|
+
};
|
|
474
|
+
/**
|
|
475
|
+
* Dispatches or queues a dictionary-object-set notification.
|
|
476
|
+
*
|
|
477
|
+
* @param object - Object inserted or replaced in a named dictionary
|
|
478
|
+
* @param key - Dictionary key under which the object is stored
|
|
479
|
+
*/
|
|
480
|
+
AcDbDatabase.prototype.notifyDictObjectSet = function (object, key) {
|
|
481
|
+
if (this.isEventBatched()) {
|
|
482
|
+
this._pendingDictObjectSet.push({ object: object, key: key });
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
this.events.dictObjetSet.dispatch({
|
|
486
|
+
database: this,
|
|
487
|
+
object: object,
|
|
488
|
+
key: key
|
|
489
|
+
});
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* Dispatches or queues a dictionary-object-erased notification.
|
|
493
|
+
*
|
|
494
|
+
* @param object - Object removed from a named dictionary
|
|
495
|
+
* @param key - Dictionary key that previously referenced the object
|
|
496
|
+
*/
|
|
497
|
+
AcDbDatabase.prototype.notifyDictObjectErased = function (object, key) {
|
|
498
|
+
if (this.isEventBatched()) {
|
|
499
|
+
this._pendingDictObjectErased.push({ object: object, key: key });
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
this.events.dictObjectErased.dispatch({
|
|
503
|
+
database: this,
|
|
504
|
+
object: object,
|
|
505
|
+
key: key
|
|
506
|
+
});
|
|
507
|
+
};
|
|
508
|
+
/**
|
|
509
|
+
* Dispatches all notifications accumulated while event batching was active.
|
|
510
|
+
*
|
|
511
|
+
* Entity-modified events are deduplicated by entity; appended and erased
|
|
512
|
+
* entities are dispatched in batch arrays where applicable.
|
|
513
|
+
*/
|
|
514
|
+
AcDbDatabase.prototype.flushEventBatch = function () {
|
|
515
|
+
var e_4, _a, e_5, _b, e_6, _c;
|
|
516
|
+
if (this._pendingEntityModified.size > 0) {
|
|
517
|
+
var modified = __spreadArray([], __read(this._pendingEntityModified), false);
|
|
518
|
+
this._pendingEntityModified.clear();
|
|
519
|
+
try {
|
|
520
|
+
for (var modified_1 = __values(modified), modified_1_1 = modified_1.next(); !modified_1_1.done; modified_1_1 = modified_1.next()) {
|
|
521
|
+
var entity = modified_1_1.value;
|
|
522
|
+
this.events.entityModified.dispatch({
|
|
523
|
+
database: this,
|
|
524
|
+
entity: entity
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
529
|
+
finally {
|
|
530
|
+
try {
|
|
531
|
+
if (modified_1_1 && !modified_1_1.done && (_a = modified_1.return)) _a.call(modified_1);
|
|
532
|
+
}
|
|
533
|
+
finally { if (e_4) throw e_4.error; }
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (this._pendingEntityAppended.length > 0) {
|
|
537
|
+
var appended = this._pendingEntityAppended;
|
|
538
|
+
this._pendingEntityAppended = [];
|
|
539
|
+
this.events.entityAppended.dispatch({
|
|
540
|
+
database: this,
|
|
541
|
+
entity: appended
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
if (this._pendingEntityErased.length > 0) {
|
|
545
|
+
var erased = this._pendingEntityErased;
|
|
546
|
+
this._pendingEntityErased = [];
|
|
547
|
+
this.events.entityErased.dispatch({
|
|
548
|
+
database: this,
|
|
549
|
+
entity: erased
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
if (this._pendingDictObjectSet.length > 0) {
|
|
553
|
+
var dictSet = this._pendingDictObjectSet;
|
|
554
|
+
this._pendingDictObjectSet = [];
|
|
555
|
+
try {
|
|
556
|
+
for (var dictSet_1 = __values(dictSet), dictSet_1_1 = dictSet_1.next(); !dictSet_1_1.done; dictSet_1_1 = dictSet_1.next()) {
|
|
557
|
+
var _d = dictSet_1_1.value, object = _d.object, key = _d.key;
|
|
558
|
+
this.events.dictObjetSet.dispatch({
|
|
559
|
+
database: this,
|
|
560
|
+
object: object,
|
|
561
|
+
key: key
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
566
|
+
finally {
|
|
567
|
+
try {
|
|
568
|
+
if (dictSet_1_1 && !dictSet_1_1.done && (_b = dictSet_1.return)) _b.call(dictSet_1);
|
|
569
|
+
}
|
|
570
|
+
finally { if (e_5) throw e_5.error; }
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
if (this._pendingDictObjectErased.length > 0) {
|
|
574
|
+
var dictErased = this._pendingDictObjectErased;
|
|
575
|
+
this._pendingDictObjectErased = [];
|
|
576
|
+
try {
|
|
577
|
+
for (var dictErased_1 = __values(dictErased), dictErased_1_1 = dictErased_1.next(); !dictErased_1_1.done; dictErased_1_1 = dictErased_1.next()) {
|
|
578
|
+
var _e = dictErased_1_1.value, object = _e.object, key = _e.key;
|
|
579
|
+
this.events.dictObjectErased.dispatch({
|
|
580
|
+
database: this,
|
|
581
|
+
object: object,
|
|
582
|
+
key: key
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
587
|
+
finally {
|
|
588
|
+
try {
|
|
589
|
+
if (dictErased_1_1 && !dictErased_1_1.done && (_c = dictErased_1.return)) _c.call(dictErased_1);
|
|
590
|
+
}
|
|
591
|
+
finally { if (e_6) throw e_6.error; }
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
};
|
|
271
595
|
Object.defineProperty(AcDbDatabase.prototype, "formatter", {
|
|
272
596
|
/**
|
|
273
597
|
* Formatter for linear distances, point coordinates, and angles using this database's
|
|
@@ -1227,7 +1551,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1227
1551
|
AcDbDatabase.prototype.openUri = function (url, options) {
|
|
1228
1552
|
return __awaiter(this, void 0, void 0, function () {
|
|
1229
1553
|
var response, contentLength, totalBytes, loadedBytes, reader, chunks, _a, done, value, percentage, content, position, chunks_1, chunks_1_1, chunk, fileName, fileExtension;
|
|
1230
|
-
var
|
|
1554
|
+
var e_7, _b;
|
|
1231
1555
|
var _c;
|
|
1232
1556
|
return __generator(this, function (_d) {
|
|
1233
1557
|
switch (_d.label) {
|
|
@@ -1290,12 +1614,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1290
1614
|
position += chunk.length;
|
|
1291
1615
|
}
|
|
1292
1616
|
}
|
|
1293
|
-
catch (
|
|
1617
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1294
1618
|
finally {
|
|
1295
1619
|
try {
|
|
1296
1620
|
if (chunks_1_1 && !chunks_1_1.done && (_b = chunks_1.return)) _b.call(chunks_1);
|
|
1297
1621
|
}
|
|
1298
|
-
finally { if (
|
|
1622
|
+
finally { if (e_7) throw e_7.error; }
|
|
1299
1623
|
}
|
|
1300
1624
|
fileName = this.getFileNameFromUri(url);
|
|
1301
1625
|
if (fileName) {
|
|
@@ -1480,7 +1804,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1480
1804
|
}));
|
|
1481
1805
|
};
|
|
1482
1806
|
AcDbDatabase.prototype.hasDefaultTextStyle = function () {
|
|
1483
|
-
var
|
|
1807
|
+
var e_8, _a, e_9, _b;
|
|
1484
1808
|
var defaultNames = [DEFAULT_TEXT_STYLE, 'STANDARD'];
|
|
1485
1809
|
try {
|
|
1486
1810
|
for (var defaultNames_1 = __values(defaultNames), defaultNames_1_1 = defaultNames_1.next(); !defaultNames_1_1.done; defaultNames_1_1 = defaultNames_1.next()) {
|
|
@@ -1490,12 +1814,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1490
1814
|
}
|
|
1491
1815
|
}
|
|
1492
1816
|
}
|
|
1493
|
-
catch (
|
|
1817
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1494
1818
|
finally {
|
|
1495
1819
|
try {
|
|
1496
1820
|
if (defaultNames_1_1 && !defaultNames_1_1.done && (_a = defaultNames_1.return)) _a.call(defaultNames_1);
|
|
1497
1821
|
}
|
|
1498
|
-
finally { if (
|
|
1822
|
+
finally { if (e_8) throw e_8.error; }
|
|
1499
1823
|
}
|
|
1500
1824
|
try {
|
|
1501
1825
|
for (var _c = __values(this.tables.textStyleTable.newIterator()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -1505,12 +1829,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1505
1829
|
}
|
|
1506
1830
|
}
|
|
1507
1831
|
}
|
|
1508
|
-
catch (
|
|
1832
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
1509
1833
|
finally {
|
|
1510
1834
|
try {
|
|
1511
1835
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1512
1836
|
}
|
|
1513
|
-
finally { if (
|
|
1837
|
+
finally { if (e_9) throw e_9.error; }
|
|
1514
1838
|
}
|
|
1515
1839
|
return false;
|
|
1516
1840
|
};
|
|
@@ -1597,7 +1921,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1597
1921
|
* Ensures one MLINE style exists for the provided style name.
|
|
1598
1922
|
*/
|
|
1599
1923
|
AcDbDatabase.prototype.ensureMLineStyle = function (styleName) {
|
|
1600
|
-
var
|
|
1924
|
+
var e_10, _a;
|
|
1601
1925
|
var dictionary = this.objects.mlineStyle;
|
|
1602
1926
|
var normalizedName = styleName.trim();
|
|
1603
1927
|
if (!normalizedName)
|
|
@@ -1614,12 +1938,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1614
1938
|
}
|
|
1615
1939
|
}
|
|
1616
1940
|
}
|
|
1617
|
-
catch (
|
|
1941
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1618
1942
|
finally {
|
|
1619
1943
|
try {
|
|
1620
1944
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1621
1945
|
}
|
|
1622
|
-
finally { if (
|
|
1946
|
+
finally { if (e_10) throw e_10.error; }
|
|
1623
1947
|
}
|
|
1624
1948
|
var style = new AcDbMlineStyle();
|
|
1625
1949
|
style.styleName = normalizedName;
|
|
@@ -1641,7 +1965,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1641
1965
|
* Ensures one MLEADER style exists for the provided style name.
|
|
1642
1966
|
*/
|
|
1643
1967
|
AcDbDatabase.prototype.ensureMLeaderStyle = function (styleName) {
|
|
1644
|
-
var
|
|
1968
|
+
var e_11, _a;
|
|
1645
1969
|
var dictionary = this.objects.mleaderStyle;
|
|
1646
1970
|
var normalizedName = styleName.trim();
|
|
1647
1971
|
if (!normalizedName)
|
|
@@ -1657,12 +1981,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1657
1981
|
}
|
|
1658
1982
|
}
|
|
1659
1983
|
}
|
|
1660
|
-
catch (
|
|
1984
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
1661
1985
|
finally {
|
|
1662
1986
|
try {
|
|
1663
1987
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1664
1988
|
}
|
|
1665
|
-
finally { if (
|
|
1989
|
+
finally { if (e_11) throw e_11.error; }
|
|
1666
1990
|
}
|
|
1667
1991
|
var style = new AcDbMLeaderStyle();
|
|
1668
1992
|
// Match AutoCAD "Standard" defaults observed in exported DXF.
|
|
@@ -1789,7 +2113,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1789
2113
|
* @param filer - DXF output writer.
|
|
1790
2114
|
*/
|
|
1791
2115
|
AcDbDatabase.prototype.writeDxfBlocksSection = function (filer) {
|
|
1792
|
-
var
|
|
2116
|
+
var e_12, _a, e_13, _b;
|
|
1793
2117
|
filer.startSection('BLOCKS');
|
|
1794
2118
|
try {
|
|
1795
2119
|
for (var _c = __values(this.tables.blockTable.newIterator()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -1797,28 +2121,28 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1797
2121
|
btr.dxfOutBlockBegin(filer);
|
|
1798
2122
|
if (!btr.isModelSapce && !btr.isPaperSapce) {
|
|
1799
2123
|
try {
|
|
1800
|
-
for (var _e = (
|
|
2124
|
+
for (var _e = (e_13 = void 0, __values(btr.newIterator())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1801
2125
|
var entity = _f.value;
|
|
1802
2126
|
this.writeDxfEntity(filer, entity);
|
|
1803
2127
|
}
|
|
1804
2128
|
}
|
|
1805
|
-
catch (
|
|
2129
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1806
2130
|
finally {
|
|
1807
2131
|
try {
|
|
1808
2132
|
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1809
2133
|
}
|
|
1810
|
-
finally { if (
|
|
2134
|
+
finally { if (e_13) throw e_13.error; }
|
|
1811
2135
|
}
|
|
1812
2136
|
}
|
|
1813
2137
|
btr.dxfOutBlockEnd(filer);
|
|
1814
2138
|
}
|
|
1815
2139
|
}
|
|
1816
|
-
catch (
|
|
2140
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1817
2141
|
finally {
|
|
1818
2142
|
try {
|
|
1819
2143
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1820
2144
|
}
|
|
1821
|
-
finally { if (
|
|
2145
|
+
finally { if (e_12) throw e_12.error; }
|
|
1822
2146
|
}
|
|
1823
2147
|
filer.endSection();
|
|
1824
2148
|
};
|
|
@@ -1828,7 +2152,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1828
2152
|
* @param filer - DXF output writer.
|
|
1829
2153
|
*/
|
|
1830
2154
|
AcDbDatabase.prototype.writeDxfEntitiesSection = function (filer) {
|
|
1831
|
-
var
|
|
2155
|
+
var e_14, _a, e_15, _b;
|
|
1832
2156
|
filer.startSection('ENTITIES');
|
|
1833
2157
|
try {
|
|
1834
2158
|
for (var _c = __values(this.tables.blockTable.newIterator()), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
@@ -1836,26 +2160,26 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1836
2160
|
if (!btr.isModelSapce && !btr.isPaperSapce)
|
|
1837
2161
|
continue;
|
|
1838
2162
|
try {
|
|
1839
|
-
for (var _e = (
|
|
2163
|
+
for (var _e = (e_15 = void 0, __values(btr.newIterator())), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
1840
2164
|
var entity = _f.value;
|
|
1841
2165
|
this.writeDxfEntity(filer, entity);
|
|
1842
2166
|
}
|
|
1843
2167
|
}
|
|
1844
|
-
catch (
|
|
2168
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1845
2169
|
finally {
|
|
1846
2170
|
try {
|
|
1847
2171
|
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
1848
2172
|
}
|
|
1849
|
-
finally { if (
|
|
2173
|
+
finally { if (e_15) throw e_15.error; }
|
|
1850
2174
|
}
|
|
1851
2175
|
}
|
|
1852
2176
|
}
|
|
1853
|
-
catch (
|
|
2177
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1854
2178
|
finally {
|
|
1855
2179
|
try {
|
|
1856
2180
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1857
2181
|
}
|
|
1858
|
-
finally { if (
|
|
2182
|
+
finally { if (e_14) throw e_14.error; }
|
|
1859
2183
|
}
|
|
1860
2184
|
filer.endSection();
|
|
1861
2185
|
};
|
|
@@ -1865,7 +2189,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1865
2189
|
* @param filer - DXF output writer.
|
|
1866
2190
|
*/
|
|
1867
2191
|
AcDbDatabase.prototype.writeDxfObjectsSection = function (filer) {
|
|
1868
|
-
var
|
|
2192
|
+
var e_16, _a, e_17, _b, e_18, _c, e_19, _d, e_20, _e;
|
|
1869
2193
|
filer.startSection('OBJECTS');
|
|
1870
2194
|
var rootDict = this.objects.dictionary;
|
|
1871
2195
|
rootDict.ownerId = '0';
|
|
@@ -1930,12 +2254,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1930
2254
|
layout.dxfOut(filer);
|
|
1931
2255
|
}
|
|
1932
2256
|
}
|
|
1933
|
-
catch (
|
|
2257
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
1934
2258
|
finally {
|
|
1935
2259
|
try {
|
|
1936
2260
|
if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
|
|
1937
2261
|
}
|
|
1938
|
-
finally { if (
|
|
2262
|
+
finally { if (e_16) throw e_16.error; }
|
|
1939
2263
|
}
|
|
1940
2264
|
try {
|
|
1941
2265
|
for (var _j = __values(this.objects.imageDefinition.entries()), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
@@ -1944,12 +2268,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1944
2268
|
imageDef.dxfOut(filer);
|
|
1945
2269
|
}
|
|
1946
2270
|
}
|
|
1947
|
-
catch (
|
|
2271
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
1948
2272
|
finally {
|
|
1949
2273
|
try {
|
|
1950
2274
|
if (_k && !_k.done && (_b = _j.return)) _b.call(_j);
|
|
1951
2275
|
}
|
|
1952
|
-
finally { if (
|
|
2276
|
+
finally { if (e_17) throw e_17.error; }
|
|
1953
2277
|
}
|
|
1954
2278
|
try {
|
|
1955
2279
|
for (var _m = __values(this.objects.mleaderStyle.entries()), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
@@ -1958,12 +2282,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1958
2282
|
mleaderStyle.dxfOut(filer);
|
|
1959
2283
|
}
|
|
1960
2284
|
}
|
|
1961
|
-
catch (
|
|
2285
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
1962
2286
|
finally {
|
|
1963
2287
|
try {
|
|
1964
2288
|
if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
|
|
1965
2289
|
}
|
|
1966
|
-
finally { if (
|
|
2290
|
+
finally { if (e_18) throw e_18.error; }
|
|
1967
2291
|
}
|
|
1968
2292
|
try {
|
|
1969
2293
|
for (var _q = __values(this.objects.mlineStyle.entries()), _r = _q.next(); !_r.done; _r = _q.next()) {
|
|
@@ -1972,12 +2296,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1972
2296
|
mlineStyle.dxfOut(filer);
|
|
1973
2297
|
}
|
|
1974
2298
|
}
|
|
1975
|
-
catch (
|
|
2299
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
1976
2300
|
finally {
|
|
1977
2301
|
try {
|
|
1978
2302
|
if (_r && !_r.done && (_d = _q.return)) _d.call(_q);
|
|
1979
2303
|
}
|
|
1980
|
-
finally { if (
|
|
2304
|
+
finally { if (e_19) throw e_19.error; }
|
|
1981
2305
|
}
|
|
1982
2306
|
try {
|
|
1983
2307
|
for (var _t = __values(this.objects.xrecord.entries()), _u = _t.next(); !_u.done; _u = _t.next()) {
|
|
@@ -1986,12 +2310,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
1986
2310
|
xrecord.dxfOut(filer);
|
|
1987
2311
|
}
|
|
1988
2312
|
}
|
|
1989
|
-
catch (
|
|
2313
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
1990
2314
|
finally {
|
|
1991
2315
|
try {
|
|
1992
2316
|
if (_u && !_u.done && (_e = _t.return)) _e.call(_t);
|
|
1993
2317
|
}
|
|
1994
|
-
finally { if (
|
|
2318
|
+
finally { if (e_20) throw e_20.error; }
|
|
1995
2319
|
}
|
|
1996
2320
|
filer.endSection();
|
|
1997
2321
|
};
|
|
@@ -2005,7 +2329,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
2005
2329
|
* @param recordType - DXF record type name for each table record.
|
|
2006
2330
|
*/
|
|
2007
2331
|
AcDbDatabase.prototype.writeDxfTable = function (filer, tableName, table, records, recordType) {
|
|
2008
|
-
var
|
|
2332
|
+
var e_21, _a;
|
|
2009
2333
|
var items = __spreadArray([], __read(records), false);
|
|
2010
2334
|
filer.startTable(tableName);
|
|
2011
2335
|
table.dxfOut(filer);
|
|
@@ -2021,12 +2345,12 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
2021
2345
|
record.dxfOut(filer);
|
|
2022
2346
|
}
|
|
2023
2347
|
}
|
|
2024
|
-
catch (
|
|
2348
|
+
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
2025
2349
|
finally {
|
|
2026
2350
|
try {
|
|
2027
2351
|
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
|
|
2028
2352
|
}
|
|
2029
|
-
finally { if (
|
|
2353
|
+
finally { if (e_21) throw e_21.error; }
|
|
2030
2354
|
}
|
|
2031
2355
|
filer.endTable();
|
|
2032
2356
|
};
|
|
@@ -2056,6 +2380,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
2056
2380
|
* ```
|
|
2057
2381
|
*/
|
|
2058
2382
|
AcDbDatabase.prototype.clear = function () {
|
|
2383
|
+
this.transactionManager.clearUndoStack();
|
|
2059
2384
|
// Clear all tables and dictionaries
|
|
2060
2385
|
this._tables.blockTable.removeAll();
|
|
2061
2386
|
this._tables.dimStyleTable.removeAll();
|
|
@@ -2076,28 +2401,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
2076
2401
|
* Updates a sysvar value and dispatches the change event only when the value changed.
|
|
2077
2402
|
*/
|
|
2078
2403
|
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);
|
|
2404
|
+
AcDbSysVarManager.instance().applyVarMutation(sysVarName, currentValue, nextValue, this, function () { return setter(nextValue); });
|
|
2101
2405
|
};
|
|
2102
2406
|
/**
|
|
2103
2407
|
* Normalizes special linetype aliases to the internal canonical names.
|