@mlightcad/data-model 1.2.25 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data-model.cjs +5 -5
- package/dist/data-model.js +7157 -6768
- package/dist/dxf-parser-worker.js +681 -490
- package/lib/converter/AcDbDxfConverter.d.ts +3 -3
- package/lib/converter/AcDbDxfConverter.d.ts.map +1 -1
- package/lib/converter/AcDbDxfConverter.js +8 -6
- package/lib/converter/AcDbDxfConverter.js.map +1 -1
- package/lib/converter/AcDbDxfParser.d.ts +23 -0
- package/lib/converter/AcDbDxfParser.d.ts.map +1 -0
- package/lib/converter/AcDbDxfParser.js +85 -0
- package/lib/converter/AcDbDxfParser.js.map +1 -0
- package/lib/converter/AcDbRegenerator.d.ts +101 -0
- package/lib/converter/AcDbRegenerator.d.ts.map +1 -0
- package/lib/converter/AcDbRegenerator.js +334 -0
- package/lib/converter/AcDbRegenerator.js.map +1 -0
- package/lib/converter/index.d.ts +1 -0
- package/lib/converter/index.d.ts.map +1 -1
- package/lib/converter/index.js +1 -0
- package/lib/converter/index.js.map +1 -1
- package/lib/converter/worker/AcDbDxfParserWorker.d.ts +9 -0
- package/lib/converter/worker/AcDbDxfParserWorker.d.ts.map +1 -1
- package/lib/converter/worker/AcDbDxfParserWorker.js +5 -6
- package/lib/converter/worker/AcDbDxfParserWorker.js.map +1 -1
- package/lib/database/AcDbDatabase.d.ts +21 -1
- package/lib/database/AcDbDatabase.d.ts.map +1 -1
- package/lib/database/AcDbDatabase.js +58 -4
- package/lib/database/AcDbDatabase.js.map +1 -1
- package/lib/database/AcDbDatabaseConverter.d.ts +3 -3
- package/lib/database/AcDbDatabaseConverter.d.ts.map +1 -1
- package/lib/database/AcDbDatabaseConverter.js +3 -4
- package/lib/database/AcDbDatabaseConverter.js.map +1 -1
- package/lib/database/AcDbDwgVersion.d.ts +32 -0
- package/lib/database/AcDbDwgVersion.d.ts.map +1 -0
- package/lib/database/AcDbDwgVersion.js +76 -0
- package/lib/database/AcDbDwgVersion.js.map +1 -0
- package/lib/database/index.d.ts +1 -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/misc/AcDbCodePage.d.ts +50 -0
- package/lib/misc/AcDbCodePage.d.ts.map +1 -0
- package/lib/misc/AcDbCodePage.js +100 -0
- package/lib/misc/AcDbCodePage.js.map +1 -0
- package/lib/misc/AcDbObjectIterator.d.ts +9 -0
- package/lib/misc/AcDbObjectIterator.d.ts.map +1 -1
- package/lib/misc/AcDbObjectIterator.js +17 -0
- package/lib/misc/AcDbObjectIterator.js.map +1 -1
- package/lib/misc/index.d.ts +1 -0
- package/lib/misc/index.d.ts.map +1 -1
- package/lib/misc/index.js +1 -0
- package/lib/misc/index.js.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var __values = (this && this.__values) || function(o) {
|
|
53
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
54
|
+
if (m) return m.call(o);
|
|
55
|
+
if (o && typeof o.length === "number") return {
|
|
56
|
+
next: function () {
|
|
57
|
+
if (o && i >= o.length) o = void 0;
|
|
58
|
+
return { value: o && o[i++], done: !o };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
62
|
+
};
|
|
63
|
+
import { AcDbDatabaseConverter } from '../database/AcDbDatabaseConverter';
|
|
64
|
+
import { AcDbBatchProcessing } from './AcDbBatchProcessing';
|
|
65
|
+
/**
|
|
66
|
+
* Database regenerator.
|
|
67
|
+
*
|
|
68
|
+
* This class extends AcDbDatabaseConverter so that it can leverage the existing
|
|
69
|
+
* logic to open one database such as progress notification. However, it doesn't
|
|
70
|
+
* really do any conversion tasks and just pass one database instance and
|
|
71
|
+
* it.
|
|
72
|
+
*/
|
|
73
|
+
var AcDbRegenerator = /** @class */ (function (_super) {
|
|
74
|
+
__extends(AcDbRegenerator, _super);
|
|
75
|
+
function AcDbRegenerator(db) {
|
|
76
|
+
var _this = _super.call(this, {}) || this;
|
|
77
|
+
_this._database = db;
|
|
78
|
+
return _this;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Does nothing and always passes the database instance back.
|
|
82
|
+
* @returns The database instance associated with this generator
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
AcDbRegenerator.prototype.parse = function () {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
+
return __generator(this, function (_a) {
|
|
88
|
+
return [2 /*return*/, {
|
|
89
|
+
model: this._database,
|
|
90
|
+
data: {
|
|
91
|
+
unknownEntityCount: 0
|
|
92
|
+
}
|
|
93
|
+
}];
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Does nothing and always returns one empty array.
|
|
99
|
+
*
|
|
100
|
+
* @returns An empty array
|
|
101
|
+
*/
|
|
102
|
+
AcDbRegenerator.prototype.getFonts = function () {
|
|
103
|
+
return [];
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Processes entities in batches to maintain UI responsiveness.
|
|
107
|
+
*
|
|
108
|
+
* This method breaks up the entity processing work into smaller chunks that are
|
|
109
|
+
* executed asynchronously. This is often referred to as "batch processing" or
|
|
110
|
+
* "cooperative multitasking," where the time-consuming task is broken into
|
|
111
|
+
* smaller pieces and executed in small intervals to allow the UI to remain responsive.
|
|
112
|
+
*
|
|
113
|
+
* @param source - Source database
|
|
114
|
+
* @param target - Target database
|
|
115
|
+
* @param minimumChunkSize - Minimum number of entities to process in each chunk
|
|
116
|
+
* @param startPercentage - Object containing the starting percentage for progress tracking
|
|
117
|
+
* @param progress - Optional callback for progress updates
|
|
118
|
+
*/
|
|
119
|
+
AcDbRegenerator.prototype.processEntities = function (source, target, minimumChunkSize, startPercentage, progress) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
+
var entities, entityCount, batchProcessor, modelSpaceBlockTableRecord;
|
|
122
|
+
var _this = this;
|
|
123
|
+
return __generator(this, function (_a) {
|
|
124
|
+
switch (_a.label) {
|
|
125
|
+
case 0:
|
|
126
|
+
entities = source.tables.blockTable.modelSpace.newIterator().toArray();
|
|
127
|
+
entityCount = entities.length;
|
|
128
|
+
batchProcessor = new AcDbBatchProcessing(entityCount, 100 - startPercentage.value, minimumChunkSize);
|
|
129
|
+
// Groups entities by their `type` property and flattens the result into a single array.
|
|
130
|
+
if (this.config.convertByEntityType) {
|
|
131
|
+
entities = this.groupAndFlattenByType(entities);
|
|
132
|
+
}
|
|
133
|
+
modelSpaceBlockTableRecord = target.tables.blockTable.modelSpace;
|
|
134
|
+
return [4 /*yield*/, batchProcessor.processChunk(function (start, end) { return __awaiter(_this, void 0, void 0, function () {
|
|
135
|
+
var dbEntities, entityType, i, entity, percentage;
|
|
136
|
+
return __generator(this, function (_a) {
|
|
137
|
+
switch (_a.label) {
|
|
138
|
+
case 0:
|
|
139
|
+
dbEntities = [];
|
|
140
|
+
entityType = start < end ? entities[start].type : '';
|
|
141
|
+
for (i = start; i < end; i++) {
|
|
142
|
+
entity = entities[i];
|
|
143
|
+
if (this.config.convertByEntityType && entity.type !== entityType) {
|
|
144
|
+
this.triggerEvents(modelSpaceBlockTableRecord, dbEntities);
|
|
145
|
+
dbEntities = [];
|
|
146
|
+
entityType = entity.type;
|
|
147
|
+
}
|
|
148
|
+
dbEntities.push(entity);
|
|
149
|
+
}
|
|
150
|
+
// Use batch append to improve performance
|
|
151
|
+
this.triggerEvents(modelSpaceBlockTableRecord, dbEntities);
|
|
152
|
+
if (!progress) return [3 /*break*/, 2];
|
|
153
|
+
percentage = startPercentage.value +
|
|
154
|
+
(end / entityCount) * (100 - startPercentage.value);
|
|
155
|
+
if (percentage > 100)
|
|
156
|
+
percentage = 100;
|
|
157
|
+
return [4 /*yield*/, progress(percentage, 'ENTITY', 'IN-PROGRESS')];
|
|
158
|
+
case 1:
|
|
159
|
+
_a.sent();
|
|
160
|
+
_a.label = 2;
|
|
161
|
+
case 2: return [2 /*return*/];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}); })];
|
|
165
|
+
case 1:
|
|
166
|
+
_a.sent();
|
|
167
|
+
return [2 /*return*/];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Processes blocks.
|
|
174
|
+
*/
|
|
175
|
+
AcDbRegenerator.prototype.processBlocks = function () {
|
|
176
|
+
var e_1, _a;
|
|
177
|
+
var blocks = this._database.tables.blockTable.newIterator();
|
|
178
|
+
try {
|
|
179
|
+
for (var blocks_1 = __values(blocks), blocks_1_1 = blocks_1.next(); !blocks_1_1.done; blocks_1_1 = blocks_1.next()) {
|
|
180
|
+
var block = blocks_1_1.value;
|
|
181
|
+
var entities = block.newIterator().toArray();
|
|
182
|
+
this.triggerEvents(block, entities);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
186
|
+
finally {
|
|
187
|
+
try {
|
|
188
|
+
if (blocks_1_1 && !blocks_1_1.done && (_a = blocks_1.return)) _a.call(blocks_1);
|
|
189
|
+
}
|
|
190
|
+
finally { if (e_1) throw e_1.error; }
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Processes header variables.
|
|
195
|
+
*/
|
|
196
|
+
AcDbRegenerator.prototype.processHeader = function () {
|
|
197
|
+
// Do nothing
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Processes block table records.
|
|
201
|
+
*/
|
|
202
|
+
AcDbRegenerator.prototype.processBlockTables = function () {
|
|
203
|
+
// Do nothing for now. Maybe it needs to trigger some events in the future.
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Processes objects defined in database.
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
AcDbRegenerator.prototype.processObjects = function () {
|
|
210
|
+
var e_2, _a, e_3, _b;
|
|
211
|
+
var layouts = this._database.dictionaries.layouts.newIterator();
|
|
212
|
+
try {
|
|
213
|
+
for (var layouts_1 = __values(layouts), layouts_1_1 = layouts_1.next(); !layouts_1_1.done; layouts_1_1 = layouts_1.next()) {
|
|
214
|
+
var layout = layouts_1_1.value;
|
|
215
|
+
this._database.events.dictObjetSet.dispatch({
|
|
216
|
+
database: this._database,
|
|
217
|
+
object: layout,
|
|
218
|
+
key: layout.layoutName
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
223
|
+
finally {
|
|
224
|
+
try {
|
|
225
|
+
if (layouts_1_1 && !layouts_1_1.done && (_a = layouts_1.return)) _a.call(layouts_1);
|
|
226
|
+
}
|
|
227
|
+
finally { if (e_2) throw e_2.error; }
|
|
228
|
+
}
|
|
229
|
+
var imageDefs = this._database.dictionaries.imageDefs.newIterator();
|
|
230
|
+
try {
|
|
231
|
+
for (var imageDefs_1 = __values(imageDefs), imageDefs_1_1 = imageDefs_1.next(); !imageDefs_1_1.done; imageDefs_1_1 = imageDefs_1.next()) {
|
|
232
|
+
var imageDef = imageDefs_1_1.value;
|
|
233
|
+
this._database.events.dictObjetSet.dispatch({
|
|
234
|
+
database: this._database,
|
|
235
|
+
object: imageDef,
|
|
236
|
+
key: imageDef.objectId
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
241
|
+
finally {
|
|
242
|
+
try {
|
|
243
|
+
if (imageDefs_1_1 && !imageDefs_1_1.done && (_b = imageDefs_1.return)) _b.call(imageDefs_1);
|
|
244
|
+
}
|
|
245
|
+
finally { if (e_3) throw e_3.error; }
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Processes viewport table records.
|
|
250
|
+
*/
|
|
251
|
+
AcDbRegenerator.prototype.processViewports = function () {
|
|
252
|
+
// Do nothing for now. Maybe it needs to trigger some events in the future.
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Processes layer table records.
|
|
256
|
+
*/
|
|
257
|
+
AcDbRegenerator.prototype.processLayers = function () {
|
|
258
|
+
var _this = this;
|
|
259
|
+
var layers = this._database.tables.layerTable.newIterator().toArray();
|
|
260
|
+
layers.forEach(function (layer) {
|
|
261
|
+
_this._database.events.layerAppended.dispatch({
|
|
262
|
+
database: _this._database,
|
|
263
|
+
layer: layer
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Processes linetype table records.
|
|
269
|
+
*/
|
|
270
|
+
AcDbRegenerator.prototype.processLineTypes = function () {
|
|
271
|
+
// Do nothing for now. Maybe it needs to trigger some events in the future.
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Processes text style table records.
|
|
275
|
+
*/
|
|
276
|
+
AcDbRegenerator.prototype.processTextStyles = function () {
|
|
277
|
+
// Do nothing for now. Maybe it needs to trigger some events in the future.
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Processes text style table records.
|
|
281
|
+
*/
|
|
282
|
+
AcDbRegenerator.prototype.processDimStyles = function () {
|
|
283
|
+
// Do nothing for now. Maybe it needs to trigger some events in the future.
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* Groups entities by their `type` property and flattens the result into a single array.
|
|
287
|
+
*
|
|
288
|
+
* The order of `type` groups follows the order in which they first appear in the input array.
|
|
289
|
+
* Items within each group preserve their original order.
|
|
290
|
+
*
|
|
291
|
+
* This runs in O(n) time, which is generally faster than sorting when you
|
|
292
|
+
* don't care about alphabetical order of types.
|
|
293
|
+
*
|
|
294
|
+
* @param entities - The array of entities to group and flatten.
|
|
295
|
+
*
|
|
296
|
+
* @returns A new array of entities grouped by their `type` property.
|
|
297
|
+
*/
|
|
298
|
+
AcDbRegenerator.prototype.groupAndFlattenByType = function (entities) {
|
|
299
|
+
var e_4, _a;
|
|
300
|
+
var groups = {};
|
|
301
|
+
var order = [];
|
|
302
|
+
try {
|
|
303
|
+
for (var entities_1 = __values(entities), entities_1_1 = entities_1.next(); !entities_1_1.done; entities_1_1 = entities_1.next()) {
|
|
304
|
+
var entity = entities_1_1.value;
|
|
305
|
+
if (!groups[entity.type]) {
|
|
306
|
+
groups[entity.type] = [];
|
|
307
|
+
order.push(entity.type);
|
|
308
|
+
}
|
|
309
|
+
groups[entity.type].push(entity);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
313
|
+
finally {
|
|
314
|
+
try {
|
|
315
|
+
if (entities_1_1 && !entities_1_1.done && (_a = entities_1.return)) _a.call(entities_1);
|
|
316
|
+
}
|
|
317
|
+
finally { if (e_4) throw e_4.error; }
|
|
318
|
+
}
|
|
319
|
+
return order.flatMap(function (type) { return groups[type]; });
|
|
320
|
+
};
|
|
321
|
+
AcDbRegenerator.prototype.triggerEvents = function (btr, entities) {
|
|
322
|
+
// When creating one block, it will also go to this function. But we don't want `entityAppended` event
|
|
323
|
+
// tiggered in this case. So check whether the block name is name of the model space.
|
|
324
|
+
if (btr.isModelSapce || btr.isPaperSapce) {
|
|
325
|
+
btr.database.events.entityAppended.dispatch({
|
|
326
|
+
database: btr.database,
|
|
327
|
+
entity: entities
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
return AcDbRegenerator;
|
|
332
|
+
}(AcDbDatabaseConverter));
|
|
333
|
+
export { AcDbRegenerator };
|
|
334
|
+
//# sourceMappingURL=AcDbRegenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcDbRegenerator.js","sourceRoot":"","sources":["../../src/converter/AcDbRegenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAEL,qBAAqB,EACtB,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D;;;;;;;GAOG;AACH;IAAqC,mCAAmC;IAEtE,yBAAY,EAAgB;QAC1B,YAAA,MAAK,YAAC,EAAE,CAAC,SAAA;QACT,KAAI,CAAC,SAAS,GAAG,EAAE,CAAA;;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"}
|
package/lib/converter/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/converter/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/converter/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,UAAU,CAAA"}
|
package/lib/converter/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/converter/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/converter/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,UAAU,CAAA"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
import { ParsedDxf } from '@mlightcad/dxf-json';
|
|
2
|
+
import { AcDbBaseWorker } from './AcDbBaseWorker';
|
|
3
|
+
/**
|
|
4
|
+
* DXF parsing worker
|
|
5
|
+
*/
|
|
6
|
+
declare class AcDbDxfParserWorker extends AcDbBaseWorker<ArrayBuffer, ParsedDxf> {
|
|
7
|
+
protected executeTask(data: ArrayBuffer): Promise<ParsedDxf>;
|
|
8
|
+
}
|
|
9
|
+
export declare const dxfParser: AcDbDxfParserWorker;
|
|
1
10
|
export {};
|
|
2
11
|
//# sourceMappingURL=AcDbDxfParserWorker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcDbDxfParserWorker.d.ts","sourceRoot":"","sources":["../../../src/converter/worker/AcDbDxfParserWorker.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"AcDbDxfParserWorker.d.ts","sourceRoot":"","sources":["../../../src/converter/worker/AcDbDxfParserWorker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;GAEG;AACH,cAAM,mBAAoB,SAAQ,cAAc,CAAC,WAAW,EAAE,SAAS,CAAC;cACtD,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC;CAInE;AAGD,eAAO,MAAM,SAAS,qBAA4B,CAAA"}
|
|
@@ -49,8 +49,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
49
49
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
import DxfParser from '@mlightcad/dxf-json';
|
|
52
|
+
import { AcDbDxfParser } from '../AcDbDxfParser';
|
|
54
53
|
import { AcDbBaseWorker } from './AcDbBaseWorker';
|
|
55
54
|
/**
|
|
56
55
|
* DXF parsing worker
|
|
@@ -60,17 +59,17 @@ var AcDbDxfParserWorker = /** @class */ (function (_super) {
|
|
|
60
59
|
function AcDbDxfParserWorker() {
|
|
61
60
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
62
61
|
}
|
|
63
|
-
AcDbDxfParserWorker.prototype.executeTask = function (
|
|
62
|
+
AcDbDxfParserWorker.prototype.executeTask = function (data) {
|
|
64
63
|
return __awaiter(this, void 0, void 0, function () {
|
|
65
64
|
var parser;
|
|
66
65
|
return __generator(this, function (_a) {
|
|
67
|
-
parser = new
|
|
68
|
-
return [2 /*return*/, parser.
|
|
66
|
+
parser = new AcDbDxfParser();
|
|
67
|
+
return [2 /*return*/, parser.parse(data)];
|
|
69
68
|
});
|
|
70
69
|
});
|
|
71
70
|
};
|
|
72
71
|
return AcDbDxfParserWorker;
|
|
73
72
|
}(AcDbBaseWorker));
|
|
74
73
|
// Initialize the worker
|
|
75
|
-
new AcDbDxfParserWorker();
|
|
74
|
+
export var dxfParser = new AcDbDxfParserWorker();
|
|
76
75
|
//# sourceMappingURL=AcDbDxfParserWorker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcDbDxfParserWorker.js","sourceRoot":"","sources":["../../../src/converter/worker/AcDbDxfParserWorker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"AcDbDxfParserWorker.js","sourceRoot":"","sources":["../../../src/converter/worker/AcDbDxfParserWorker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;GAEG;AACH;IAAkC,uCAAsC;IAAxE;;IAKA,CAAC;IAJiB,yCAAW,GAA3B,UAA4B,IAAiB;;;;gBACrC,MAAM,GAAG,IAAI,aAAa,EAAE,CAAA;gBAClC,sBAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAA;;;KAC1B;IACH,0BAAC;AAAD,CAAC,AALD,CAAkC,cAAc,GAK/C;AAED,wBAAwB;AACxB,MAAM,CAAC,IAAM,SAAS,GAAG,IAAI,mBAAmB,EAAE,CAAA"}
|
|
@@ -12,6 +12,7 @@ import { AcDbLinetypeTable } from './AcDbLinetypeTable';
|
|
|
12
12
|
import { AcDbTextStyleTable } from './AcDbTextStyleTable';
|
|
13
13
|
import { AcDbViewportTable } from './AcDbViewportTable';
|
|
14
14
|
import { AcGeBox3d, AcGePoint3d, AcGePoint3dLike } from '@mlightcad/geometry-engine';
|
|
15
|
+
import { AcDbDwgVersion } from './AcDbDwgVersion';
|
|
15
16
|
/**
|
|
16
17
|
* Event arguments for object events in the dictionary.
|
|
17
18
|
*/
|
|
@@ -227,6 +228,8 @@ export interface AcDbCreateDefaultDataOptions {
|
|
|
227
228
|
* ```
|
|
228
229
|
*/
|
|
229
230
|
export declare class AcDbDatabase extends AcDbObject {
|
|
231
|
+
/** Version of the database */
|
|
232
|
+
private _version;
|
|
230
233
|
/** Angle base for the database */
|
|
231
234
|
private _angBase;
|
|
232
235
|
/** Angle direction for the database */
|
|
@@ -360,6 +363,19 @@ export declare class AcDbDatabase extends AcDbObject {
|
|
|
360
363
|
* ```
|
|
361
364
|
*/
|
|
362
365
|
set aunits(value: number);
|
|
366
|
+
/**
|
|
367
|
+
* Gets the version of the database.
|
|
368
|
+
*
|
|
369
|
+
* @returns The version of the database
|
|
370
|
+
*
|
|
371
|
+
*/
|
|
372
|
+
get version(): AcDbDwgVersion;
|
|
373
|
+
/**
|
|
374
|
+
* Sets the version of the database.
|
|
375
|
+
*
|
|
376
|
+
* @param value - The version value of the database
|
|
377
|
+
*/
|
|
378
|
+
set version(value: string | number);
|
|
363
379
|
/**
|
|
364
380
|
* Gets the drawing-units value for automatic scaling of blocks, images, or xrefs.
|
|
365
381
|
*
|
|
@@ -498,7 +514,7 @@ export declare class AcDbDatabase extends AcDbObject {
|
|
|
498
514
|
* await database.read(dwgArrayBuffer, { readOnly: true }, AcDbFileType.DWG);
|
|
499
515
|
* ```
|
|
500
516
|
*/
|
|
501
|
-
read(data:
|
|
517
|
+
read(data: ArrayBuffer, options: AcDbOpenDatabaseOptions, fileType?: AcDbFileType): Promise<void>;
|
|
502
518
|
/**
|
|
503
519
|
* Read AutoCAD DXF or DWG drawing specified by the URL into the database object.
|
|
504
520
|
* The method automatically detects the file type based on the URL extension:
|
|
@@ -508,6 +524,10 @@ export declare class AcDbDatabase extends AcDbObject {
|
|
|
508
524
|
* @param options Input options to read drawing data
|
|
509
525
|
*/
|
|
510
526
|
openUri(url: string, options: AcDbOpenDatabaseOptions): Promise<void>;
|
|
527
|
+
/**
|
|
528
|
+
* Triggers xxxAppended events with data in the database to redraw the associated viewer.
|
|
529
|
+
*/
|
|
530
|
+
regen(): Promise<void>;
|
|
511
531
|
/**
|
|
512
532
|
* Create default layer, line type, dimension type, text style and layout.
|
|
513
533
|
* @param - Options to specify data to create
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AcDbDatabase.d.ts","sourceRoot":"","sources":["../../src/database/AcDbDatabase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"AcDbDatabase.d.ts","sourceRoot":"","sources":["../../src/database/AcDbDatabase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAE/D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAElD,OAAO,EAEL,YAAY,EACb,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,OAAO,EACL,cAAc,EACd,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB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K,EAAE,MAAM,EAGvB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,WAAW,CAExB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,eAAe,EAKhC;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,WAAW,CAExB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,eAAe,EAKhC;IAED;;OAEG;IACH,IAAI,OAAO,cAEV;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAGvB;IAED;;;;;OAKG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAGvB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,IAAI,CACR,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,uBAAuB,EAChC,QAAQ,GAAE,YAA+B;IA2C3C;;;;;;;OAOG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IA+E3E;;OAEG;IACG,KAAK;IAwBX;;;OAGG;IACH,iBAAiB,CACf,OAAO,GAAE,4BAMR;IA0FH;;;;;;;;;;OAUG;IACH,OAAO,CAAC,KAAK;IAab;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,+BAA+B;CAMxC"}
|
|
@@ -63,6 +63,7 @@ var __values = (this && this.__values) || function(o) {
|
|
|
63
63
|
/* eslint-disable simple-import-sort/imports */
|
|
64
64
|
import { AcCmColor, AcCmEventManager } from '@mlightcad/common';
|
|
65
65
|
import { AcDbObject } from '../base';
|
|
66
|
+
import { AcDbRegenerator } from '../converter';
|
|
66
67
|
import { AcDbDatabaseConverterManager, AcDbFileType } from './AcDbDatabaseConverterManager';
|
|
67
68
|
import { AcDbAngleUnits, AcDbUnitsValue } from '../misc';
|
|
68
69
|
import { AcDbDictionary, AcDbLayout, AcDbLayoutDictionary } from '../object';
|
|
@@ -77,6 +78,7 @@ import { AcGeBox3d } from '@mlightcad/geometry-engine';
|
|
|
77
78
|
import { AcDbLinetypeTableRecord } from './AcDbLinetypeTableRecord';
|
|
78
79
|
import { AcDbTextStyleTableRecord } from './AcDbTextStyleTableRecord';
|
|
79
80
|
import { AcDbDimStyleTableRecord } from './AcDbDimStyleTableRecord';
|
|
81
|
+
import { AcDbDwgVersion } from './AcDbDwgVersion';
|
|
80
82
|
/**
|
|
81
83
|
* The AcDbDatabase class represents an AutoCAD drawing file.
|
|
82
84
|
*
|
|
@@ -126,6 +128,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
126
128
|
/** Fired when a header system variable is changed */
|
|
127
129
|
headerSysVarChanged: new AcCmEventManager()
|
|
128
130
|
};
|
|
131
|
+
_this._version = new AcDbDwgVersion('AC1014');
|
|
129
132
|
_this._angBase = 0;
|
|
130
133
|
_this._angDir = 0;
|
|
131
134
|
_this._aunits = AcDbAngleUnits.DecimalDegrees;
|
|
@@ -263,6 +266,28 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
263
266
|
enumerable: false,
|
|
264
267
|
configurable: true
|
|
265
268
|
});
|
|
269
|
+
Object.defineProperty(AcDbDatabase.prototype, "version", {
|
|
270
|
+
/**
|
|
271
|
+
* Gets the version of the database.
|
|
272
|
+
*
|
|
273
|
+
* @returns The version of the database
|
|
274
|
+
*
|
|
275
|
+
*/
|
|
276
|
+
get: function () {
|
|
277
|
+
return this._version;
|
|
278
|
+
},
|
|
279
|
+
/**
|
|
280
|
+
* Sets the version of the database.
|
|
281
|
+
*
|
|
282
|
+
* @param value - The version value of the database
|
|
283
|
+
*/
|
|
284
|
+
set: function (value) {
|
|
285
|
+
this._version = new AcDbDwgVersion(value);
|
|
286
|
+
this.triggerHeaderSysVarChangedEvent('version');
|
|
287
|
+
},
|
|
288
|
+
enumerable: false,
|
|
289
|
+
configurable: true
|
|
290
|
+
});
|
|
266
291
|
Object.defineProperty(AcDbDatabase.prototype, "insunits", {
|
|
267
292
|
/**
|
|
268
293
|
* Gets the drawing-units value for automatic scaling of blocks, images, or xrefs.
|
|
@@ -559,7 +584,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
559
584
|
*/
|
|
560
585
|
AcDbDatabase.prototype.openUri = function (url, options) {
|
|
561
586
|
return __awaiter(this, void 0, void 0, function () {
|
|
562
|
-
var response, contentLength, totalBytes, loadedBytes, reader, chunks, _a, done, value, percentage, content, position, chunks_1, chunks_1_1, chunk, fileExtension
|
|
587
|
+
var response, contentLength, totalBytes, loadedBytes, reader, chunks, _a, done, value, percentage, content, position, chunks_1, chunks_1_1, chunk, fileExtension;
|
|
563
588
|
var e_1, _b;
|
|
564
589
|
var _c;
|
|
565
590
|
return __generator(this, function (_d) {
|
|
@@ -638,9 +663,7 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
638
663
|
// DWG files are binary, convert to ArrayBuffer
|
|
639
664
|
_d.sent();
|
|
640
665
|
return [3 /*break*/, 8];
|
|
641
|
-
case 6:
|
|
642
|
-
textContent = new TextDecoder().decode(content);
|
|
643
|
-
return [4 /*yield*/, this.read(textContent, options, AcDbFileType.DXF)];
|
|
666
|
+
case 6: return [4 /*yield*/, this.read(content.buffer, options, AcDbFileType.DXF)];
|
|
644
667
|
case 7:
|
|
645
668
|
_d.sent();
|
|
646
669
|
_d.label = 8;
|
|
@@ -656,6 +679,37 @@ var AcDbDatabase = /** @class */ (function (_super) {
|
|
|
656
679
|
});
|
|
657
680
|
});
|
|
658
681
|
};
|
|
682
|
+
/**
|
|
683
|
+
* Triggers xxxAppended events with data in the database to redraw the associated viewer.
|
|
684
|
+
*/
|
|
685
|
+
AcDbDatabase.prototype.regen = function () {
|
|
686
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
687
|
+
var converter;
|
|
688
|
+
var _this = this;
|
|
689
|
+
return __generator(this, function (_a) {
|
|
690
|
+
switch (_a.label) {
|
|
691
|
+
case 0:
|
|
692
|
+
converter = new AcDbRegenerator(this);
|
|
693
|
+
return [4 /*yield*/, converter.read(null, this, 500, function (percentage, stage, stageStatus, data) { return __awaiter(_this, void 0, void 0, function () {
|
|
694
|
+
return __generator(this, function (_a) {
|
|
695
|
+
this.events.openProgress.dispatch({
|
|
696
|
+
database: this,
|
|
697
|
+
percentage: percentage,
|
|
698
|
+
stage: 'CONVERSION',
|
|
699
|
+
subStage: stage,
|
|
700
|
+
subStageStatus: stageStatus,
|
|
701
|
+
data: data
|
|
702
|
+
});
|
|
703
|
+
return [2 /*return*/];
|
|
704
|
+
});
|
|
705
|
+
}); })];
|
|
706
|
+
case 1:
|
|
707
|
+
_a.sent();
|
|
708
|
+
return [2 /*return*/];
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
});
|
|
712
|
+
};
|
|
659
713
|
/**
|
|
660
714
|
* Create default layer, line type, dimension type, text style and layout.
|
|
661
715
|
* @param - Options to specify data to create
|