@ccpc/core 0.1.1 → 0.1.2
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/index.js +2080 -0
- package/package.json +4 -23
- package/types/display/dirty_prop.d.ts +3 -0
- package/types/display/state_object.d.ts +30 -0
- package/types/document/doc_saver.d.ts +13 -0
- package/types/document/document.d.ts +37 -0
- package/types/document/element_mgr.d.ts +28 -0
- package/types/document/i_document.d.ts +60 -0
- package/{dist → types}/document/id_pool.d.ts +3 -1
- package/types/element/db.d.ts +49 -0
- package/types/element/element.d.ts +55 -0
- package/{dist → types}/element/element_decorator.d.ts +0 -1
- package/{dist → types}/element/element_id.d.ts +1 -2
- package/types/element/i_element.d.ts +64 -0
- package/types/element/tmp_element/tmp_element.d.ts +6 -0
- package/types/element/tmp_element/tmp_element_painter.d.ts +27 -0
- package/types/grep/display/display_object.d.ts +37 -0
- package/types/grep/display/display_object_mgr.d.ts +23 -0
- package/types/grep/display/grep_display.d.ts +16 -0
- package/types/grep/gcurve2d.d.ts +15 -0
- package/types/grep/ggroup.d.ts +29 -0
- package/types/grep/gnode.d.ts +110 -0
- package/types/grep/gnode2d.d.ts +9 -0
- package/types/grep/gnode_type.d.ts +10 -0
- package/types/grep/gpoint2d.d.ts +14 -0
- package/types/grep/gpolycurve.d.ts +13 -0
- package/types/grep/gpolygon.d.ts +14 -0
- package/types/grep/grep.d.ts +15 -0
- package/types/grep/gtext2d.d.ts +14 -0
- package/types/grep/i_style.d.ts +42 -0
- package/types/grep/style_utils.d.ts +22 -0
- package/types/index.d.ts +41 -0
- package/types/model_view/i_high_light.d.ts +6 -0
- package/types/model_view/i_selection.d.ts +6 -0
- package/types/model_view/model_changed_cache.d.ts +35 -0
- package/types/model_view/model_view.d.ts +45 -0
- package/types/render/i_render.d.ts +24 -0
- package/types/render/null_render.d.ts +10 -0
- package/types/render/render_node.d.ts +68 -0
- package/types/render/render_node_util.d.ts +4 -0
- package/types/request/buildin_request/redo_request.d.ts +5 -0
- package/types/request/buildin_request/undo_request.d.ts +5 -0
- package/{dist → types}/request/i_request.d.ts +0 -1
- package/{dist → types}/request/request.d.ts +0 -1
- package/{dist → types}/request/request_decorator.d.ts +0 -1
- package/{dist → types}/request/request_mgr.d.ts +0 -1
- package/{dist → types}/toolkit/class_manager.d.ts +0 -1
- package/types/toolkit/cmath_util.d.ts +4 -0
- package/{dist → types}/toolkit/debug_util.d.ts +0 -1
- package/{dist → types}/transaction/i_transaction.d.ts +0 -1
- package/{dist → types}/transaction/i_transaction_base.d.ts +0 -1
- package/{dist → types}/transaction/i_transaction_group.d.ts +0 -1
- package/{dist → types}/transaction/transaction.d.ts +0 -1
- package/{dist → types}/transaction/transaction_base.d.ts +0 -1
- package/{dist → types}/transaction/transaction_group.d.ts +0 -1
- package/{dist → types}/transaction/transaction_mgr.d.ts +0 -1
- package/{dist → types}/transaction/undo_redo_entity.d.ts +0 -1
- package/types/types/type_define.d.ts +31 -0
- package/{dist → types}/types/type_guard.d.ts +1 -1
- package/README.md +0 -11
- package/dist/document/document.d.ts +0 -21
- package/dist/document/document.d.ts.map +0 -1
- package/dist/document/document.js +0 -53
- package/dist/document/element_mgr.d.ts +0 -11
- package/dist/document/element_mgr.d.ts.map +0 -1
- package/dist/document/element_mgr.js +0 -27
- package/dist/document/i_document.d.ts +0 -19
- package/dist/document/i_document.d.ts.map +0 -1
- package/dist/document/i_document.js +0 -1
- package/dist/document/id_pool.d.ts.map +0 -1
- package/dist/document/id_pool.js +0 -67
- package/dist/element/c_element.d.ts +0 -6
- package/dist/element/c_element.d.ts.map +0 -1
- package/dist/element/c_element.js +0 -6
- package/dist/element/element.d.ts +0 -42
- package/dist/element/element.d.ts.map +0 -1
- package/dist/element/element.js +0 -72
- package/dist/element/element_decorator.d.ts.map +0 -1
- package/dist/element/element_decorator.js +0 -40
- package/dist/element/element_id.d.ts.map +0 -1
- package/dist/element/element_id.js +0 -30
- package/dist/element/i_element.d.ts +0 -30
- package/dist/element/i_element.d.ts.map +0 -1
- package/dist/element/i_element.js +0 -1
- package/dist/index.d.ts +0 -12
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -8
- package/dist/request/i_request.d.ts.map +0 -1
- package/dist/request/i_request.js +0 -1
- package/dist/request/request.d.ts.map +0 -1
- package/dist/request/request.js +0 -11
- package/dist/request/request_decorator.d.ts.map +0 -1
- package/dist/request/request_decorator.js +0 -10
- package/dist/request/request_mgr.d.ts.map +0 -1
- package/dist/request/request_mgr.js +0 -77
- package/dist/toolkit/class_manager.d.ts.map +0 -1
- package/dist/toolkit/class_manager.js +0 -54
- package/dist/toolkit/debug_util.d.ts.map +0 -1
- package/dist/toolkit/debug_util.js +0 -15
- package/dist/transaction/i_transaction.d.ts.map +0 -1
- package/dist/transaction/i_transaction.js +0 -1
- package/dist/transaction/i_transaction_base.d.ts.map +0 -1
- package/dist/transaction/i_transaction_base.js +0 -11
- package/dist/transaction/i_transaction_group.d.ts.map +0 -1
- package/dist/transaction/i_transaction_group.js +0 -1
- package/dist/transaction/transaction.d.ts.map +0 -1
- package/dist/transaction/transaction.js +0 -41
- package/dist/transaction/transaction_base.d.ts.map +0 -1
- package/dist/transaction/transaction_base.js +0 -32
- package/dist/transaction/transaction_group.d.ts.map +0 -1
- package/dist/transaction/transaction_group.js +0 -242
- package/dist/transaction/transaction_mgr.d.ts.map +0 -1
- package/dist/transaction/transaction_mgr.js +0 -84
- package/dist/transaction/undo_redo_entity.d.ts.map +0 -1
- package/dist/transaction/undo_redo_entity.js +0 -261
- package/dist/types/dump_type.d.ts +0 -4
- package/dist/types/dump_type.d.ts.map +0 -1
- package/dist/types/dump_type.js +0 -1
- package/dist/types/type_guard.d.ts.map +0 -1
- package/dist/types/type_guard.js +0 -1
package/index.js
ADDED
|
@@ -0,0 +1,2080 @@
|
|
|
1
|
+
import { Vec3 as P, brep as ut, Loader as W, alg as J, EN_GEO_TYPE as pt, Vec2 as $ } from "@ccpc/math";
|
|
2
|
+
class m {
|
|
3
|
+
constructor(t) {
|
|
4
|
+
this._id = -1, this._id = t;
|
|
5
|
+
}
|
|
6
|
+
static get INVALID() {
|
|
7
|
+
return new m(-1);
|
|
8
|
+
}
|
|
9
|
+
asInt() {
|
|
10
|
+
return this._id;
|
|
11
|
+
}
|
|
12
|
+
equals(t) {
|
|
13
|
+
return this._id === t.asInt();
|
|
14
|
+
}
|
|
15
|
+
isValid() {
|
|
16
|
+
return this._id && this._id > -1;
|
|
17
|
+
}
|
|
18
|
+
toString() {
|
|
19
|
+
return "" + this._id;
|
|
20
|
+
}
|
|
21
|
+
dump() {
|
|
22
|
+
return {
|
|
23
|
+
id: this._id
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
load(t) {
|
|
27
|
+
this._id = t.id;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const q = {
|
|
31
|
+
C_GREP: "C_GRep",
|
|
32
|
+
VISIBLE: "visible"
|
|
33
|
+
}, N = /* @__PURE__ */ Symbol("math"), kt = {
|
|
34
|
+
newGeoArray: () => [N],
|
|
35
|
+
newGeoObject: () => N
|
|
36
|
+
};
|
|
37
|
+
class d {
|
|
38
|
+
static assert(t, e, s, r) {
|
|
39
|
+
if (!t) {
|
|
40
|
+
const i = `${e}
|
|
41
|
+
报告人:${s}
|
|
42
|
+
报告时间:${r}
|
|
43
|
+
点击确定可debug`;
|
|
44
|
+
throw new Error(i);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
static warn(t, e, s, r) {
|
|
48
|
+
if (!t) {
|
|
49
|
+
const i = `${e}
|
|
50
|
+
报告人:${s}
|
|
51
|
+
报告时间:${r}
|
|
52
|
+
点击确定可debug`;
|
|
53
|
+
console.warn(i);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
class H {
|
|
58
|
+
constructor() {
|
|
59
|
+
this._kvMap = /* @__PURE__ */ new Map(), this._vkMap = /* @__PURE__ */ new Map();
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 注册类
|
|
63
|
+
*/
|
|
64
|
+
registerCls(t, e) {
|
|
65
|
+
this._kvMap.get(t) && d.assert(!1, `${String(e)}已注册,请检查`, "wg", "2026-03-05"), this._kvMap.set(t, e), this._vkMap.set(e, t);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 获取类
|
|
69
|
+
*/
|
|
70
|
+
getCls(t) {
|
|
71
|
+
return this._kvMap.get(t);
|
|
72
|
+
}
|
|
73
|
+
getClsEnsure(t) {
|
|
74
|
+
const e = this.getCls(t);
|
|
75
|
+
return d.assert(e, `未获取到键为${String(t)}对应的类`, "wg", "2026-03-05"), e;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 获取标识
|
|
79
|
+
*/
|
|
80
|
+
getClsName(t) {
|
|
81
|
+
return this._vkMap.get(t);
|
|
82
|
+
}
|
|
83
|
+
getClsNameEnsure(t) {
|
|
84
|
+
const e = this.getClsName(t);
|
|
85
|
+
return d.assert(e, `未获取到值为${String(t)}对应的标识`, "wg", "2026-03-05"), e;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 获取所有类
|
|
89
|
+
*/
|
|
90
|
+
getAllCls() {
|
|
91
|
+
return [...this._kvMap.values()];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 查看所有类个数
|
|
95
|
+
*/
|
|
96
|
+
getClsLength() {
|
|
97
|
+
return this._kvMap.size;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
class k {
|
|
101
|
+
constructor() {
|
|
102
|
+
this._elements = /* @__PURE__ */ new Map(), this._eleClsMgr = new H();
|
|
103
|
+
}
|
|
104
|
+
static instance() {
|
|
105
|
+
return this._instance || (this._instance = new k()), this._instance;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 注册Element
|
|
109
|
+
*/
|
|
110
|
+
registerElement(t, e) {
|
|
111
|
+
this._eleClsMgr.registerCls(t, e);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 根据序列化id获取Element构造函数
|
|
115
|
+
*/
|
|
116
|
+
getElementClsByCtor(t) {
|
|
117
|
+
return this._eleClsMgr.getCls(t);
|
|
118
|
+
}
|
|
119
|
+
getElementById(t) {
|
|
120
|
+
return this._elements.get(t);
|
|
121
|
+
}
|
|
122
|
+
getAllElements() {
|
|
123
|
+
return [...this._elements.values()];
|
|
124
|
+
}
|
|
125
|
+
getAllElementIds() {
|
|
126
|
+
return [...this._elements.keys()];
|
|
127
|
+
}
|
|
128
|
+
add(t, e = !0) {
|
|
129
|
+
return !e && this._elements.has(t.id.asInt()) ? !1 : (this._elements.set(t.id.asInt(), t), !0);
|
|
130
|
+
}
|
|
131
|
+
delete(t) {
|
|
132
|
+
return this._elements.delete(t);
|
|
133
|
+
}
|
|
134
|
+
clear() {
|
|
135
|
+
this._elements.clear();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const Z = k.instance(), u = class u {
|
|
139
|
+
constructor() {
|
|
140
|
+
this._unstablePool = [], this._tmpPool = [], this._currentStableIndex = 0, this.reset();
|
|
141
|
+
}
|
|
142
|
+
reset(t) {
|
|
143
|
+
this._unstablePool.splice(0);
|
|
144
|
+
for (let e = 0; e < u.MAX_UNSTABLE_NUM; e++) {
|
|
145
|
+
const s = u.MAX_UNSTABLE_OFFSET + e;
|
|
146
|
+
if (!t?.has(s) && (this._unstablePool.push(s), this._unstablePool.length >= 1e3))
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
this._tmpPool.splice(0);
|
|
150
|
+
for (let e = 0; e < u.MAX_TMP_NUM; e++) {
|
|
151
|
+
const s = u.MAX_TMP_OFFSET + e;
|
|
152
|
+
t?.has(s) || this._tmpPool.push(s);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
genId(t) {
|
|
156
|
+
return t.isTemporary() ? this.genTmpId() : t.dontSave() ? this.genUnstableId() : this.genStableId();
|
|
157
|
+
}
|
|
158
|
+
genTmpId() {
|
|
159
|
+
const t = this._tmpPool.pop();
|
|
160
|
+
if (t !== void 0)
|
|
161
|
+
return new m(t);
|
|
162
|
+
}
|
|
163
|
+
genUnstableId() {
|
|
164
|
+
const t = this._unstablePool.pop();
|
|
165
|
+
if (t !== void 0)
|
|
166
|
+
return new m(t);
|
|
167
|
+
}
|
|
168
|
+
genStableId() {
|
|
169
|
+
const t = ++this._currentStableIndex;
|
|
170
|
+
return d.assert(t < u.MAX_UNSTABLE_OFFSET, "stable id资源已耗尽", "wg", "2026-03-04"), new m(t);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* 重置稳定ID的起始计数
|
|
174
|
+
*/
|
|
175
|
+
clearStableId(t) {
|
|
176
|
+
this._currentStableIndex = t;
|
|
177
|
+
}
|
|
178
|
+
isStableId(t) {
|
|
179
|
+
return t < u.MAX_UNSTABLE_OFFSET;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
u.MAX_TMP_NUM = 1e3, u.MAX_TMP_OFFSET = 2 ** 32 - u.MAX_TMP_NUM, u.MAX_UNSTABLE_NUM = 1e6, u.MAX_UNSTABLE_OFFSET = 2 ** 32 - u.MAX_UNSTABLE_NUM - u.MAX_TMP_NUM;
|
|
183
|
+
let G = u;
|
|
184
|
+
var _ = /* @__PURE__ */ ((n) => (n.NOT_STARTED = "not-started", n.STARTED = "started", n.COMMITTED = "committed", n.ROLLED_BACK = "rolled_back", n))(_ || {});
|
|
185
|
+
class Q {
|
|
186
|
+
constructor(t, e) {
|
|
187
|
+
this._status = _.NOT_STARTED, this.name = e, this.doc = t;
|
|
188
|
+
}
|
|
189
|
+
start() {
|
|
190
|
+
return this._status = _.STARTED, !0;
|
|
191
|
+
}
|
|
192
|
+
getStartParent() {
|
|
193
|
+
const t = this.doc.transactionMgr.getCurrentTransactionGroup();
|
|
194
|
+
return d.assert(t, "没有找到TransactionGroup", "wg", "2026-03-05"), t.startTransaction(this), t;
|
|
195
|
+
}
|
|
196
|
+
getStatus() {
|
|
197
|
+
return this._status;
|
|
198
|
+
}
|
|
199
|
+
setStatus(t) {
|
|
200
|
+
this._status = t;
|
|
201
|
+
}
|
|
202
|
+
rollBack() {
|
|
203
|
+
return this._status = _.ROLLED_BACK, !0;
|
|
204
|
+
}
|
|
205
|
+
isTransactionLike(t) {
|
|
206
|
+
return this instanceof t;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
var l = /* @__PURE__ */ ((n) => (n[n.ELEMENT_CREATE = 0] = "ELEMENT_CREATE", n[n.ELEMENT_UPDATE = 1] = "ELEMENT_UPDATE", n[n.ELEMENT_DELETE = 2] = "ELEMENT_DELETE", n))(l || {}), I = /* @__PURE__ */ ((n) => (n[n.UNKOWN = 0] = "UNKOWN", n[n.POINT = 1] = "POINT", n[n.EDGE = 2] = "EDGE", n[n.GROUP = 5] = "GROUP", n))(I || {}), v = /* @__PURE__ */ ((n) => (n.UNDER_SCORE = "_", n.C_UNDER_SCORE = "C_", n))(v || {}), B = /* @__PURE__ */ ((n) => (n.UNDO = "core.undo", n.REDO = "core.redo", n))(B || {});
|
|
210
|
+
class _t {
|
|
211
|
+
constructor(t) {
|
|
212
|
+
this._added = /* @__PURE__ */ new Set(), this._deleted = /* @__PURE__ */ new Set(), this._modified = /* @__PURE__ */ new Set(), this._modifiedProperties = /* @__PURE__ */ new Map(), this._doc = t;
|
|
213
|
+
}
|
|
214
|
+
/**监听元素增加*/
|
|
215
|
+
onElementsAdded(t) {
|
|
216
|
+
t.forEach((e) => this._added.add(e));
|
|
217
|
+
}
|
|
218
|
+
/**监听元素更新*/
|
|
219
|
+
onElementsUpdated(t) {
|
|
220
|
+
t.forEach((e) => this._modified.add(e));
|
|
221
|
+
}
|
|
222
|
+
/**监听元素删除*/
|
|
223
|
+
onElementsDeleted(t) {
|
|
224
|
+
t.forEach((e) => this._deleted.add(e));
|
|
225
|
+
}
|
|
226
|
+
clear() {
|
|
227
|
+
this._added.clear(), this._modified.clear(), this._modifiedProperties.clear(), this._deleted.clear();
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* 真正去改变db
|
|
231
|
+
*/
|
|
232
|
+
commit() {
|
|
233
|
+
return this._compress(), this._isEmpty() ? !1 : (this._modifiedProperties.clear(), this._modified.forEach((t) => {
|
|
234
|
+
const e = t.getModified();
|
|
235
|
+
!t.isTemporary() && e.length && this._modifiedProperties.set(t.id.asInt(), e), t.commit();
|
|
236
|
+
}), this._added.forEach((t) => t.commit()), this._updateViewCache(), !0);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* 数据回滚
|
|
240
|
+
*/
|
|
241
|
+
rollBack() {
|
|
242
|
+
return this._handleElementsFromDB(!0, ...this._added), this._handleElementsFromDB(!1, ...this._deleted), this._modified.forEach((t) => {
|
|
243
|
+
t.rollBack();
|
|
244
|
+
}), !0;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* undo变redo,redo变undo
|
|
248
|
+
*/
|
|
249
|
+
reverseAndExecute() {
|
|
250
|
+
this._reverse(), this._execute();
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* 合并其它提交
|
|
254
|
+
*/
|
|
255
|
+
merge(t) {
|
|
256
|
+
const e = /* @__PURE__ */ new Set([...t._added]), s = /* @__PURE__ */ new Set([...t._deleted]), r = /* @__PURE__ */ new Map();
|
|
257
|
+
t._modifiedProperties.forEach((i, o) => r.set(o, i));
|
|
258
|
+
for (const i of [...this._added])
|
|
259
|
+
d.assert(!e.has(i), "不可能发生", "wg", "2026-03-05"), s.has(i) ? (this._added.delete(i), s.delete(i)) : r.delete(i.id.asInt());
|
|
260
|
+
for (const i of [...this._deleted])
|
|
261
|
+
d.assert(
|
|
262
|
+
!e.has(i) && !s.has(i) && !r.has(i.id.asInt()),
|
|
263
|
+
"不可能发生",
|
|
264
|
+
"wg",
|
|
265
|
+
"2026-03-05"
|
|
266
|
+
);
|
|
267
|
+
for (const [i, o] of this._modifiedProperties)
|
|
268
|
+
if ([...e].find((a) => a.id.asInt() === i))
|
|
269
|
+
d.assert(!1, "不可能发生", "wg", "2026-03-05");
|
|
270
|
+
else if (r.has(i))
|
|
271
|
+
r.get(i)?.forEach((c) => {
|
|
272
|
+
const y = o.find((M) => M.propertyName === c.propertyName);
|
|
273
|
+
y ? y.newValue = c.newValue : o.push(c);
|
|
274
|
+
}), r.delete(i);
|
|
275
|
+
else if ([...s].find((a) => a.id.asInt() === i)) {
|
|
276
|
+
this._modifiedProperties.delete(i);
|
|
277
|
+
const a = [...s].find((c) => c.id.asInt() === i);
|
|
278
|
+
o.forEach(({ propertyName: c, oldValue: y }) => {
|
|
279
|
+
const M = c, b = y;
|
|
280
|
+
a && (a.db[M] = b);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
e.forEach((i) => this._added.add(i)), s.forEach((i) => this._deleted.add(i)), r.forEach((i, o) => {
|
|
284
|
+
this._modifiedProperties.set(o, i);
|
|
285
|
+
}), this._modified.clear(), this._modifiedProperties.forEach((i, o) => {
|
|
286
|
+
const a = this._doc.getElementByIdEnsure(o);
|
|
287
|
+
this._modified.add(a);
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* 将操作reverse
|
|
292
|
+
*/
|
|
293
|
+
_reverse() {
|
|
294
|
+
const t = [...this._added], e = [...this._deleted];
|
|
295
|
+
this._added.clear(), this._deleted.clear(), t.forEach((s) => this._deleted.add(s)), e.forEach((s) => this._added.add(s));
|
|
296
|
+
for (const [, s] of this._modifiedProperties)
|
|
297
|
+
for (const r of s)
|
|
298
|
+
[r.oldValue, r.newValue] = [r.newValue, r.oldValue];
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* 正向执行
|
|
302
|
+
*/
|
|
303
|
+
_execute() {
|
|
304
|
+
this._handleElementsFromDB(!1, ...this._added);
|
|
305
|
+
for (const [t, e] of this._modifiedProperties) {
|
|
306
|
+
const s = this._doc.getElementByIdEnsure(t);
|
|
307
|
+
for (const r of e) {
|
|
308
|
+
const i = r.propertyName, o = r.newValue;
|
|
309
|
+
s.db[i] = o;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
this._handleElementsFromDB(!0, ...this._deleted), this._updateViewCache();
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* 压缩事务
|
|
316
|
+
* 主要处理例如,新增一个Element,然后更改这个Element的属性,事务管理器会记录每一个操作,这时只需要记录增加的操作即可
|
|
317
|
+
*/
|
|
318
|
+
_compress() {
|
|
319
|
+
for (const t of this._added)
|
|
320
|
+
this._modified.has(t) && (t.commit(), this._modified.delete(t));
|
|
321
|
+
for (const t of this._deleted)
|
|
322
|
+
this._modified.has(t) && (t.rollBack(), this._modified.delete(t));
|
|
323
|
+
for (const t of this._deleted)
|
|
324
|
+
this._added.has(t) && (this._deleted.delete(t), this._added.delete(t));
|
|
325
|
+
}
|
|
326
|
+
/**是否为空*/
|
|
327
|
+
_isEmpty() {
|
|
328
|
+
return !this._added.size && !this._deleted.size && !this._modified.size;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* 从容器中增删对象
|
|
332
|
+
* @param del 是否删除
|
|
333
|
+
* @param eles 对象数组
|
|
334
|
+
*/
|
|
335
|
+
_handleElementsFromDB(t, ...e) {
|
|
336
|
+
const s = this._doc.elementMgr;
|
|
337
|
+
e.forEach((r) => {
|
|
338
|
+
t ? s.delete(r.id.asInt()) : s.add(r);
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* 收集使用过的id
|
|
343
|
+
*/
|
|
344
|
+
collectUsedIds(t) {
|
|
345
|
+
[...this._added, ...this._deleted].forEach((e) => t.add(e.id.asInt())), [...this._modifiedProperties.keys()].forEach((e) => t.add(e));
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* 获取所有修改的ElementId集合
|
|
349
|
+
*/
|
|
350
|
+
getModifiedElementIds() {
|
|
351
|
+
const t = /* @__PURE__ */ new Set();
|
|
352
|
+
return this._added.forEach((e) => t.add(e.id.asInt())), this._modified.forEach((e) => t.add(e.id.asInt())), t;
|
|
353
|
+
}
|
|
354
|
+
_updateViewCache() {
|
|
355
|
+
const t = /* @__PURE__ */ new Set();
|
|
356
|
+
for (const [e, s] of this._modifiedProperties) {
|
|
357
|
+
const r = this._doc.getElementByIdEnsure(e);
|
|
358
|
+
s.find(({ propertyName: i }) => r?.propShouldCacheToView(i)) && t.add(r);
|
|
359
|
+
}
|
|
360
|
+
this._doc.cacheForViewElementChanged(l.ELEMENT_CREATE, [...this._added]), this._doc.cacheForViewElementChanged(l.ELEMENT_UPDATE, [...t]), this._doc.cacheForViewElementChanged(l.ELEMENT_DELETE, [...this._deleted]);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
class S extends Q {
|
|
364
|
+
constructor(t, e) {
|
|
365
|
+
super(t, e), this.canUndo = !0, this.start(), this.undoRedoEntity = new _t(t);
|
|
366
|
+
}
|
|
367
|
+
start() {
|
|
368
|
+
return super.start(), this.doc.transactionMgr.getLastLeafTranGroup(!0)?.clearRedoList(), this.parent = this.getStartParent(), !0;
|
|
369
|
+
}
|
|
370
|
+
commit() {
|
|
371
|
+
return this.undoRedoEntity.commit() || this.parent.popTransaction(this), this._status = _.COMMITTED, !0;
|
|
372
|
+
}
|
|
373
|
+
rollBack() {
|
|
374
|
+
return this.undoRedoEntity.rollBack(), this.parent.popTransaction(this), super.rollBack(), !0;
|
|
375
|
+
}
|
|
376
|
+
reverseAndExecute() {
|
|
377
|
+
this.undoRedoEntity.reverseAndExecute();
|
|
378
|
+
}
|
|
379
|
+
merge(t) {
|
|
380
|
+
return this.undoRedoEntity.merge(t.undoRedoEntity), this;
|
|
381
|
+
}
|
|
382
|
+
collectUsedIds(t) {
|
|
383
|
+
this.undoRedoEntity.collectUsedIds(t);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
class f extends Q {
|
|
387
|
+
constructor(t, e, s = !1) {
|
|
388
|
+
super(t, e), this.isRoot = s, this.undoList = [], this.redoList = [], this._maxUndoStackSize = 30, this.isRoot = s, this.start();
|
|
389
|
+
}
|
|
390
|
+
start() {
|
|
391
|
+
return super.start(), this.isRoot || (this.doc.transactionMgr.getLastLeafTranGroup(!0)?.clearRedoList(), this.parent = this.getStartParent()), !0;
|
|
392
|
+
}
|
|
393
|
+
startTransaction(t) {
|
|
394
|
+
d.assert(
|
|
395
|
+
this.getStatus() === _.STARTED,
|
|
396
|
+
"事务组已完成,不能再启动事务",
|
|
397
|
+
"wg",
|
|
398
|
+
"2026-03-05"
|
|
399
|
+
);
|
|
400
|
+
const e = this.getCurrentTransaction()?.name, s = t.name;
|
|
401
|
+
d.assert(
|
|
402
|
+
this.getStatus() === _.STARTED && !this.getCurrentTransaction(),
|
|
403
|
+
`事务不能嵌套, 新事务${s}, 未完成的事务${e}`,
|
|
404
|
+
"wg",
|
|
405
|
+
"2025-03-05"
|
|
406
|
+
), this.undoList.push(t), this.redoList.splice(0);
|
|
407
|
+
const r = Math.max(this.getMaxUndoStackSize(), 4);
|
|
408
|
+
if (this.undoList.length <= r)
|
|
409
|
+
return;
|
|
410
|
+
const i = this.undoList.shift();
|
|
411
|
+
if (i && this.parent) {
|
|
412
|
+
const o = this._toTransaction(i), a = this._toTransaction(this.undoList[0]);
|
|
413
|
+
this.undoList[0] = o.merge(a);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* 事务或事务组转成事务
|
|
418
|
+
*/
|
|
419
|
+
_toTransaction(t) {
|
|
420
|
+
return t.isTransactionLike(f) ? t._compressToTransaction() : t;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* 事务组压缩成事务
|
|
424
|
+
*/
|
|
425
|
+
_compressToTransaction() {
|
|
426
|
+
if (!this.undoList.length) {
|
|
427
|
+
const s = new S(this.doc, "empty");
|
|
428
|
+
return s.setStatus(_.COMMITTED), s;
|
|
429
|
+
}
|
|
430
|
+
const t = this.undoList[0].name + "->" + this.undoList[this.undoList.length - 1].name;
|
|
431
|
+
for (; this.undoList.length > 1; ) {
|
|
432
|
+
const s = this.undoList.pop();
|
|
433
|
+
d.assert(s, "undoList不应该为空", "wg", "2026-03-05");
|
|
434
|
+
const r = this._toTransaction(s), i = this._toTransaction(this.undoList[this.undoList.length - 1]);
|
|
435
|
+
this.undoList[this.undoList.length - 1] = i, i.merge(r);
|
|
436
|
+
}
|
|
437
|
+
const e = this.undoList[0];
|
|
438
|
+
return e.name = t, e.canUndo = !0, e;
|
|
439
|
+
}
|
|
440
|
+
assimilate() {
|
|
441
|
+
if (this._status = _.COMMITTED, !this.undoList.length) {
|
|
442
|
+
this.parent?.undoList.pop();
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
const t = this._compressToTransaction();
|
|
446
|
+
return this.parent?.replaceTailTransaction(this, t), t;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* 压缩成一个事务,然后undo
|
|
450
|
+
*/
|
|
451
|
+
rollBack() {
|
|
452
|
+
if (super.rollBack(), !this.undoList.length)
|
|
453
|
+
return this.parent?.undoList.pop(), !0;
|
|
454
|
+
const t = this._compressToTransaction();
|
|
455
|
+
return this.parent?.replaceTailTransaction(this, t), this.parent?.undoWithoutRedo(t), !0;
|
|
456
|
+
}
|
|
457
|
+
undoWithoutRedo(t) {
|
|
458
|
+
return t.reverseAndExecute(), this.undoList.pop(), !0;
|
|
459
|
+
}
|
|
460
|
+
replaceTailTransaction(t, e) {
|
|
461
|
+
return d.assert(
|
|
462
|
+
this.undoList[this.undoList.length - 1] === t,
|
|
463
|
+
"只能替换栈顶事务",
|
|
464
|
+
"wg",
|
|
465
|
+
"2026-03-05"
|
|
466
|
+
), this.undoList[this.undoList.length - 1] = e, e.parent = this, !0;
|
|
467
|
+
}
|
|
468
|
+
canUndo() {
|
|
469
|
+
const t = this.undoList[this.undoList.length - 1];
|
|
470
|
+
return t ? t.isTransactionLike(f) ? t._undoListNotEmpty() ? t.canUndo() : !1 : t.isTransactionLike(S) ? !!t.canUndo : !1 : !1;
|
|
471
|
+
}
|
|
472
|
+
canRedo() {
|
|
473
|
+
const t = this.redoList[this.redoList.length - 1];
|
|
474
|
+
return t ? t.isTransactionLike(f) ? t._redoListNotEmpty() ? t.canRedo() : !1 : !0 : !1;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* undo数组是否为空
|
|
478
|
+
*/
|
|
479
|
+
_undoListNotEmpty() {
|
|
480
|
+
return !!this.undoList.length;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* redo是否为空
|
|
484
|
+
*/
|
|
485
|
+
_redoListNotEmpty() {
|
|
486
|
+
return !!this.redoList.length;
|
|
487
|
+
}
|
|
488
|
+
undo() {
|
|
489
|
+
const t = this.undoList[this.undoList.length - 1];
|
|
490
|
+
return t ? t.isTransactionLike(f) ? t._undoListNotEmpty() ? t.undo() : !1 : t.isTransactionLike(S) && t.canUndo ? (t.reverseAndExecute(), this.undoList.pop(), this.redoList.push(t), !0) : !1 : !1;
|
|
491
|
+
}
|
|
492
|
+
redo() {
|
|
493
|
+
const t = this.redoList[this.redoList.length - 1];
|
|
494
|
+
return t ? t.isTransactionLike(f) ? t._redoListNotEmpty() ? t.redo() : !1 : t.isTransactionLike(S) ? (t.reverseAndExecute(), this.redoList.pop(), this.undoList.push(t), !0) : !1 : !1;
|
|
495
|
+
}
|
|
496
|
+
clearRedoList() {
|
|
497
|
+
this.redoList.splice(0);
|
|
498
|
+
}
|
|
499
|
+
popTransaction(t) {
|
|
500
|
+
return d.assert(this.undoList.pop() === t, "只能pop栈顶事务", "wg", "2026-03-05"), !0;
|
|
501
|
+
}
|
|
502
|
+
getCurrentTransaction() {
|
|
503
|
+
const t = this.undoList[this.undoList.length - 1];
|
|
504
|
+
if (t && t.isTransactionLike(S) && t.getStatus() === _.STARTED)
|
|
505
|
+
return t;
|
|
506
|
+
}
|
|
507
|
+
getCurrentTransactionGroup() {
|
|
508
|
+
const t = this.undoList.slice(0).reverse().find((e) => e.isTransactionLike(f) && e.getStatus() === _.STARTED);
|
|
509
|
+
if (t && t.isTransactionLike(f))
|
|
510
|
+
return t.getCurrentTransactionGroup();
|
|
511
|
+
if (this.getStatus() === _.STARTED)
|
|
512
|
+
return this;
|
|
513
|
+
}
|
|
514
|
+
getLastLeafTransGroup(t) {
|
|
515
|
+
let e;
|
|
516
|
+
if (this.undoList[this.undoList.length - 1])
|
|
517
|
+
e = this.undoList[this.undoList.length - 1];
|
|
518
|
+
else {
|
|
519
|
+
const s = t ? this.undoList : this.redoList;
|
|
520
|
+
e = s[s.length - 1];
|
|
521
|
+
}
|
|
522
|
+
if (!e) return this;
|
|
523
|
+
if (e.isTransactionLike(S))
|
|
524
|
+
return e.parent;
|
|
525
|
+
if (e.isTransactionLike(f))
|
|
526
|
+
return e.getLastLeafTransGroup(t);
|
|
527
|
+
}
|
|
528
|
+
setMaxUndoStackSize(t) {
|
|
529
|
+
this._maxUndoStackSize = t;
|
|
530
|
+
}
|
|
531
|
+
getMaxUndoStackSize() {
|
|
532
|
+
return this._maxUndoStackSize || this.parent?.getMaxUndoStackSize() || 30;
|
|
533
|
+
}
|
|
534
|
+
collectUsedIds(t) {
|
|
535
|
+
this.undoList.concat(this.redoList).forEach((e) => e.collectUsedIds(t));
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
class ft {
|
|
539
|
+
init(t) {
|
|
540
|
+
this._rootNode = new f(t, "root", !0), this.setMaxUndoStackSize(50);
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* 清空事务树
|
|
544
|
+
*/
|
|
545
|
+
clear() {
|
|
546
|
+
this._rootNode.undoList.splice(0), this._rootNode.clearRedoList();
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* 设置最大回撤步数
|
|
550
|
+
*/
|
|
551
|
+
setMaxUndoStackSize(t) {
|
|
552
|
+
this._rootNode.setMaxUndoStackSize(t);
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* 获取当前正在进行的事务
|
|
556
|
+
*/
|
|
557
|
+
getCurrentTransaction() {
|
|
558
|
+
const t = this._rootNode.getCurrentTransactionGroup();
|
|
559
|
+
if (t)
|
|
560
|
+
return t.getCurrentTransaction();
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* 获取当前事务组
|
|
564
|
+
*/
|
|
565
|
+
getCurrentTransactionGroup() {
|
|
566
|
+
return this._rootNode.getCurrentTransactionGroup();
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* 获取最后的叶子节点事务组
|
|
570
|
+
*/
|
|
571
|
+
getLastLeafTranGroup(t) {
|
|
572
|
+
return this._rootNode.getLastLeafTransGroup(t);
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* 获取当前正在进行的事务的undoRedoEntity
|
|
576
|
+
*/
|
|
577
|
+
getCurrentUndoRedoEntity() {
|
|
578
|
+
const t = this.getCurrentTransaction();
|
|
579
|
+
return d.assert(t, "没有事务", "wg", "2025-11-18"), t.undoRedoEntity;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* 撤销
|
|
583
|
+
*/
|
|
584
|
+
undo() {
|
|
585
|
+
return !!this.getLastLeafTranGroup(!0)?.undo();
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* 回退
|
|
589
|
+
*/
|
|
590
|
+
redo() {
|
|
591
|
+
return !!this.getLastLeafTranGroup(!1)?.redo();
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* 是否可撤销
|
|
595
|
+
*/
|
|
596
|
+
canUndo() {
|
|
597
|
+
return !!this.getLastLeafTranGroup(!0)?.canUndo();
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* 是否可回退
|
|
601
|
+
*/
|
|
602
|
+
canRedo() {
|
|
603
|
+
return !!this.getLastLeafTranGroup(!1)?.canRedo();
|
|
604
|
+
}
|
|
605
|
+
idPoolGC() {
|
|
606
|
+
const t = /* @__PURE__ */ new Set();
|
|
607
|
+
return this._rootNode.collectUsedIds(t), t;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
class O {
|
|
611
|
+
constructor() {
|
|
612
|
+
this._requestClsMgr = new H();
|
|
613
|
+
}
|
|
614
|
+
static getInstance() {
|
|
615
|
+
return this._instance || (this._instance = new O()), this._instance;
|
|
616
|
+
}
|
|
617
|
+
init(t) {
|
|
618
|
+
this._doc = t;
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* 注册请求
|
|
622
|
+
*/
|
|
623
|
+
registerRequest(t, e) {
|
|
624
|
+
this._requestClsMgr.registerCls(t, e);
|
|
625
|
+
}
|
|
626
|
+
startSession(t = "") {
|
|
627
|
+
d.assert(!this._transGroup, "请先提交上一个 request", "wg", "2026-03-05"), this._transGroup = new f(this._doc, t);
|
|
628
|
+
}
|
|
629
|
+
commitSession() {
|
|
630
|
+
this._transGroup?.assimilate(), this._doc.updateView(), this._transGroup = void 0;
|
|
631
|
+
}
|
|
632
|
+
abortSession() {
|
|
633
|
+
this._transGroup?.rollBack(), this._doc.updateView(), this._transGroup = void 0;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* 创建请求
|
|
637
|
+
*/
|
|
638
|
+
createReq(t, ...e) {
|
|
639
|
+
const s = new t(...e);
|
|
640
|
+
s.setDoc(this._doc);
|
|
641
|
+
const r = this._requestClsMgr.getClsNameEnsure(t);
|
|
642
|
+
return s.canTransact() && (this._transaction = new S(this._doc, `${r}-start`)), s;
|
|
643
|
+
}
|
|
644
|
+
executeReq(t, e = !0) {
|
|
645
|
+
const s = t.execute();
|
|
646
|
+
return !e || !t.canTransact() ? (this._doc.updateView(), s) : (d.assert(this._transaction, "请先创建一个 request", "wg", "2026-03-05"), this._transaction?.commit(), this._doc.updateView(), this._transaction = void 0, s);
|
|
647
|
+
}
|
|
648
|
+
cancelReq() {
|
|
649
|
+
this._transaction?.rollBack(), this._doc.updateView(), this._transaction = void 0;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
const Y = O.getInstance();
|
|
653
|
+
class L {
|
|
654
|
+
constructor() {
|
|
655
|
+
this._displayMap = /* @__PURE__ */ new Map(), this._removedSet = /* @__PURE__ */ new Set();
|
|
656
|
+
}
|
|
657
|
+
addDisplay(t) {
|
|
658
|
+
this._displayMap.set(t.id, t);
|
|
659
|
+
}
|
|
660
|
+
getDisplay(t) {
|
|
661
|
+
return this._displayMap.get(t);
|
|
662
|
+
}
|
|
663
|
+
removeDisplayById(t) {
|
|
664
|
+
const e = this._displayMap.get(t);
|
|
665
|
+
return e ? (this._displayMap.delete(t), e.dispose(), this._removedSet.add(t), !0) : !1;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* 渲染前准备
|
|
669
|
+
*/
|
|
670
|
+
onBeforeRender(t = !1) {
|
|
671
|
+
const e = [];
|
|
672
|
+
for (const [r, i] of this._displayMap) {
|
|
673
|
+
const o = i.onBeforeRender(t);
|
|
674
|
+
o && e.push({ ...o, id: r });
|
|
675
|
+
}
|
|
676
|
+
const s = Array.from(this._removedSet);
|
|
677
|
+
return this._removedSet.clear(), { update: e, remove: s };
|
|
678
|
+
}
|
|
679
|
+
clearDisplay() {
|
|
680
|
+
for (const [t, e] of this._displayMap)
|
|
681
|
+
e.dispose(), this._removedSet.add(t);
|
|
682
|
+
this._displayMap.clear();
|
|
683
|
+
}
|
|
684
|
+
static instance() {
|
|
685
|
+
return this._instance || (this._instance = new L()), this._instance;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
class C {
|
|
689
|
+
constructor() {
|
|
690
|
+
this.style = {}, this.type = I.UNKOWN;
|
|
691
|
+
}
|
|
692
|
+
copyWorldMatrix(t) {
|
|
693
|
+
this.globalMatrix = t?.clone();
|
|
694
|
+
}
|
|
695
|
+
traverse(t) {
|
|
696
|
+
t(this), this instanceof z && this.children.forEach((e) => {
|
|
697
|
+
e.traverse(t);
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
clone() {
|
|
701
|
+
const t = this.constructor, e = new t();
|
|
702
|
+
return e.parent = this.parent, e.gnode = this.gnode, e.globalMatrix = this.globalMatrix?.clone(), e;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
class z extends C {
|
|
706
|
+
constructor() {
|
|
707
|
+
super(...arguments), this.children = [], this.type = I.GROUP;
|
|
708
|
+
}
|
|
709
|
+
add(t) {
|
|
710
|
+
this.children.push(t), t.parent = this;
|
|
711
|
+
}
|
|
712
|
+
clone() {
|
|
713
|
+
const t = super.clone();
|
|
714
|
+
return this.children.forEach((e) => {
|
|
715
|
+
t.add(e.clone());
|
|
716
|
+
}), t;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
class gt extends C {
|
|
720
|
+
constructor() {
|
|
721
|
+
super(...arguments), this.type = I.POINT;
|
|
722
|
+
}
|
|
723
|
+
// TODO clone方法
|
|
724
|
+
}
|
|
725
|
+
class tt extends C {
|
|
726
|
+
constructor() {
|
|
727
|
+
super(...arguments), this.type = I.EDGE;
|
|
728
|
+
}
|
|
729
|
+
// TODO clone方法
|
|
730
|
+
}
|
|
731
|
+
class mt extends C {
|
|
732
|
+
constructor() {
|
|
733
|
+
super(...arguments), this.text = "", this.opacity = 1, this.position = P.O();
|
|
734
|
+
}
|
|
735
|
+
clone() {
|
|
736
|
+
const t = super.clone();
|
|
737
|
+
return t.text = this.text, t.opacity = this.opacity, t.position = new P(this.position), t;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
class yt extends C {
|
|
741
|
+
/**
|
|
742
|
+
* 点集,一个点由一个索引组成
|
|
743
|
+
* 离散后的所有顶点, 此数据不渲染,只做存储使用
|
|
744
|
+
*/
|
|
745
|
+
setVerts(t) {
|
|
746
|
+
if (t instanceof Float32Array)
|
|
747
|
+
this._verts = t;
|
|
748
|
+
else {
|
|
749
|
+
this._verts = new Float32Array(3 * t.length);
|
|
750
|
+
for (let e = 0; e < t.length; e++)
|
|
751
|
+
this._verts[e * 3] = t[e].x, this._verts[e * 3 + 1] = t[e].y, this._verts[e * 3 + 2] = t[e].z;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
setIndices(t) {
|
|
755
|
+
if (t instanceof Uint32Array)
|
|
756
|
+
this._indices = t;
|
|
757
|
+
else {
|
|
758
|
+
this._indices = new Uint32Array(3 * t.length);
|
|
759
|
+
for (let e = 0; e < t.length; e++)
|
|
760
|
+
this._indices[e * 3] = t[e][0], this._indices[e * 3 + 1] = t[e][1], this._indices[e * 3 + 2] = t[e][2];
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
setNormals(t) {
|
|
764
|
+
if (t instanceof Float32Array)
|
|
765
|
+
this._normals = t;
|
|
766
|
+
else {
|
|
767
|
+
this._normals = new Float32Array(3 * t.length);
|
|
768
|
+
for (let e = 0; e < t.length; e++)
|
|
769
|
+
this._normals[e * 3] = t[e].x, this._normals[e * 3 + 1] = t[e].y, this._normals[e * 3 + 2] = t[e].z;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
setUVs(t) {
|
|
773
|
+
if (t instanceof Float32Array)
|
|
774
|
+
this._uvs = t;
|
|
775
|
+
else {
|
|
776
|
+
this._uvs = new Float32Array(2 * t.length);
|
|
777
|
+
for (let e = 0; e < t.length; e++)
|
|
778
|
+
this._uvs[e * 2] = t[e].x, this._uvs[e * 2 + 1] = t[e].y;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
getVertexes() {
|
|
782
|
+
if (!this._verts)
|
|
783
|
+
return [];
|
|
784
|
+
const t = [];
|
|
785
|
+
for (let e = 0; e < this._verts.length / 3; e++)
|
|
786
|
+
t.push(new P(this._verts[e * 3], this._verts[e * 3 + 1], this._verts[e * 3 + 2]));
|
|
787
|
+
return t;
|
|
788
|
+
}
|
|
789
|
+
getVerts() {
|
|
790
|
+
return this._verts ? this._verts : new Float32Array();
|
|
791
|
+
}
|
|
792
|
+
getIndices() {
|
|
793
|
+
return this._indices ? this._indices : new Uint32Array();
|
|
794
|
+
}
|
|
795
|
+
getNormals() {
|
|
796
|
+
return this._normals ? this._normals : new Float32Array();
|
|
797
|
+
}
|
|
798
|
+
getUVs() {
|
|
799
|
+
return this._uvs ? this._uvs : new Float32Array();
|
|
800
|
+
}
|
|
801
|
+
clone() {
|
|
802
|
+
const t = super.clone();
|
|
803
|
+
return t.setVerts(Float32Array.from(this._verts || [])), t.setNormals(Float32Array.from(this._normals || [])), t.setUVs(Float32Array.from(this._uvs || [])), t.setIndices(Uint32Array.from(this._indices || [])), t;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* 将目标RenderMesh合并到当前RenderMesh, 会改变this
|
|
807
|
+
* @param 目标RenderMesh
|
|
808
|
+
*/
|
|
809
|
+
merge(t) {
|
|
810
|
+
if (!t.getVerts().length)
|
|
811
|
+
return;
|
|
812
|
+
const e = Array.from(this._verts || []), s = e.length / 3, r = Array.from(t.getVerts());
|
|
813
|
+
e.push(...r);
|
|
814
|
+
const i = Array.from(this._normals || []), o = Array.from(t.getNormals());
|
|
815
|
+
i.push(...o);
|
|
816
|
+
const a = Array.from(this._uvs || []), c = Array.from(t.getUVs());
|
|
817
|
+
a.push(...c);
|
|
818
|
+
const y = Array.from(this._indices || []);
|
|
819
|
+
let M = Array.from(t.getIndices());
|
|
820
|
+
M = M.map((b) => b + s), y.push(...M), this._verts = new Float32Array(e), this._normals = new Float32Array(i), this._uvs = new Float32Array(a), this._indices = new Uint32Array(y);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
class Et {
|
|
824
|
+
static composeMatrix(t, e) {
|
|
825
|
+
return t ? e ? t.multiplied(e) : t.clone() : e?.clone();
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
var w = /* @__PURE__ */ ((n) => (n[n.INVALID = -1] = "INVALID", n[n.GPoint2d = 1] = "GPoint2d", n[n.GCurve2d = 2] = "GCurve2d", n[n.GGroup = 3] = "GGroup", n[n.GRep = 4] = "GRep", n[n.GPolygon = 5] = "GPolygon", n[n.GPolycurve = 6] = "GPolycurve", n[n.GText2d = 7] = "GText2d", n))(w || {});
|
|
829
|
+
const R = class R {
|
|
830
|
+
constructor() {
|
|
831
|
+
this._style = {}, this._canPick = !0, this._canSnap = !0, R.gId += 1, this.globalID = R.gId;
|
|
832
|
+
}
|
|
833
|
+
get elementId() {
|
|
834
|
+
const t = this.getRoot();
|
|
835
|
+
return t instanceof g ? t.elementId : m.INVALID;
|
|
836
|
+
}
|
|
837
|
+
get localMatrix() {
|
|
838
|
+
return this._localMatrix;
|
|
839
|
+
}
|
|
840
|
+
set localMatrix(t) {
|
|
841
|
+
this._localMatrix = t;
|
|
842
|
+
}
|
|
843
|
+
get globalMatrix() {
|
|
844
|
+
return this._globalMatrix;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* set local style only (without mixing with parent style)
|
|
848
|
+
*/
|
|
849
|
+
setStyle(t) {
|
|
850
|
+
return this._style = Object.assign(this._style, t), this;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* get final style mixing child and parent
|
|
854
|
+
*/
|
|
855
|
+
getStyle() {
|
|
856
|
+
const t = this._style, e = this.parent ? this.parent.getStyle() : {};
|
|
857
|
+
return Object.assign(e, t);
|
|
858
|
+
}
|
|
859
|
+
get canPick() {
|
|
860
|
+
return this._canPick ? this.parent ? this.parent.canPick : !0 : !1;
|
|
861
|
+
}
|
|
862
|
+
set canPick(t) {
|
|
863
|
+
this._canPick = t;
|
|
864
|
+
}
|
|
865
|
+
get canSnap() {
|
|
866
|
+
return this._canSnap ? this.parent ? this.parent.canSnap : !0 : !1;
|
|
867
|
+
}
|
|
868
|
+
set canSnap(t) {
|
|
869
|
+
this._canSnap = t;
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* GNode->RenderNode入口
|
|
873
|
+
*/
|
|
874
|
+
toRenderNode(t) {
|
|
875
|
+
return this.updateRenderNode(t), d.assert(this._renderNode, "转RenderNode失败", "wg", "2026-03-11"), this._renderNode;
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* 更新GNode对应的RenderNode
|
|
879
|
+
*/
|
|
880
|
+
updateRenderNode(t) {
|
|
881
|
+
this._renderNode || (this._renderNode = this._toRenderNodeWithoutMatrix(t)), this._renderNode.gnode = this, this._globalMatrix && this._renderNode.copyWorldMatrix(this._globalMatrix);
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* 设置局部坐标变换
|
|
885
|
+
*/
|
|
886
|
+
setLocalMatrix(t) {
|
|
887
|
+
this._localMatrix = t?.clone();
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* 从当前节点的树根计算整棵子树的世界矩阵
|
|
891
|
+
*/
|
|
892
|
+
updateGlobalMatrix() {
|
|
893
|
+
this.getRoot()._updateMatrix();
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* 递归计算当前节点及子节点的世界矩阵
|
|
897
|
+
*/
|
|
898
|
+
_updateMatrix(t) {
|
|
899
|
+
this._globalMatrix = Et.composeMatrix(t, this._localMatrix), this._renderNode && (this._renderNode.globalMatrix = this._globalMatrix?.clone()), this.getTraverseChildren().forEach((s) => {
|
|
900
|
+
s._updateMatrix(this._globalMatrix);
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* 查整根树的根节点
|
|
905
|
+
*/
|
|
906
|
+
getRoot() {
|
|
907
|
+
let t = this.parent || this;
|
|
908
|
+
for (; t.parent; )
|
|
909
|
+
t = t.parent;
|
|
910
|
+
return t;
|
|
911
|
+
}
|
|
912
|
+
traverse(t) {
|
|
913
|
+
t(this), this.getTraverseChildren().forEach((e) => {
|
|
914
|
+
e.traverse(t);
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* 返回当前节点的可遍历子节点
|
|
919
|
+
*/
|
|
920
|
+
getTraverseChildren() {
|
|
921
|
+
return [];
|
|
922
|
+
}
|
|
923
|
+
getType() {
|
|
924
|
+
return w.INVALID;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* 清除_renderNode
|
|
928
|
+
* @param clearChildren 是否清除子节点renderNode
|
|
929
|
+
* @param clearParent 是否清除父节点renderNode
|
|
930
|
+
*/
|
|
931
|
+
clearRenderNode(t = !1, e = !1) {
|
|
932
|
+
if (delete this._renderNode, e) {
|
|
933
|
+
let s = this.parent;
|
|
934
|
+
for (; s; )
|
|
935
|
+
delete s._renderNode, s = s.parent;
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
t && this.getTraverseChildren().forEach((s) => {
|
|
939
|
+
s.clearRenderNode(t);
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* 从父节点移除
|
|
944
|
+
*/
|
|
945
|
+
removeFromParent() {
|
|
946
|
+
return !this.parent || !(this.parent instanceof V) ? !1 : this.parent.removeNode(this);
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* 从其它实例复制状态
|
|
950
|
+
*/
|
|
951
|
+
_copyFrom(t) {
|
|
952
|
+
return this._style = { ...t._style }, this._localMatrix = t._localMatrix?.clone(), this._globalMatrix = t._globalMatrix?.clone(), this._canPick = t._canPick, this._canSnap = t._canSnap, this;
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
R.gId = 0;
|
|
956
|
+
let D = R;
|
|
957
|
+
class V extends D {
|
|
958
|
+
constructor() {
|
|
959
|
+
super(...arguments), this._children = [];
|
|
960
|
+
}
|
|
961
|
+
get children() {
|
|
962
|
+
return this._children;
|
|
963
|
+
}
|
|
964
|
+
isEmpty() {
|
|
965
|
+
return this._children.length < 1;
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* 添加子节点
|
|
969
|
+
*/
|
|
970
|
+
addNode(t, e) {
|
|
971
|
+
return t.parent && t.removeFromParent(), t.parent = this, e !== void 0 ? this.children.splice(e, 0, t) : this._children.push(t), t;
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* 移除子节点
|
|
975
|
+
*/
|
|
976
|
+
removeNode(t) {
|
|
977
|
+
const e = this.children.findIndex((s) => s === t);
|
|
978
|
+
return e < 0 ? !1 : (t.parent = void 0, this.children.splice(e, 1), !0);
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* 批量添加子节点
|
|
982
|
+
*/
|
|
983
|
+
addNodes(...t) {
|
|
984
|
+
t.flat().forEach((e) => this.addNode(e));
|
|
985
|
+
}
|
|
986
|
+
getTraverseChildren() {
|
|
987
|
+
return [...this._children];
|
|
988
|
+
}
|
|
989
|
+
getType() {
|
|
990
|
+
return w.GGroup;
|
|
991
|
+
}
|
|
992
|
+
_toRenderNodeWithoutMatrix(t) {
|
|
993
|
+
const e = new z();
|
|
994
|
+
return this._children.forEach((s) => {
|
|
995
|
+
const r = s.toRenderNode(t);
|
|
996
|
+
r && e.add(r);
|
|
997
|
+
}), e;
|
|
998
|
+
}
|
|
999
|
+
clone(t) {
|
|
1000
|
+
return new V()._copyFrom(this, t);
|
|
1001
|
+
}
|
|
1002
|
+
_copyFrom(t, e) {
|
|
1003
|
+
return super._copyFrom(t), t._children.forEach((s) => {
|
|
1004
|
+
this.addNode(s.clone(e));
|
|
1005
|
+
}), this;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
class g extends V {
|
|
1009
|
+
constructor() {
|
|
1010
|
+
super(...arguments), this._elementId = m.INVALID;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* 为减少对象的构造,可直接引用GRep.empty,来构造空的grep
|
|
1014
|
+
*/
|
|
1015
|
+
static get empty() {
|
|
1016
|
+
return new g();
|
|
1017
|
+
}
|
|
1018
|
+
get elementId() {
|
|
1019
|
+
return this._elementId;
|
|
1020
|
+
}
|
|
1021
|
+
set elementId(t) {
|
|
1022
|
+
this._elementId = t;
|
|
1023
|
+
}
|
|
1024
|
+
getType() {
|
|
1025
|
+
return w.GRep;
|
|
1026
|
+
}
|
|
1027
|
+
clone(t) {
|
|
1028
|
+
return new g()._copyFrom(this, t);
|
|
1029
|
+
}
|
|
1030
|
+
_copyFrom(t, e) {
|
|
1031
|
+
return super._copyFrom(t, e), this.elementId = t.elementId, this;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
function et(n) {
|
|
1035
|
+
return function(t, e) {
|
|
1036
|
+
const s = `_${e}`;
|
|
1037
|
+
Object.defineProperty(
|
|
1038
|
+
t,
|
|
1039
|
+
e,
|
|
1040
|
+
{
|
|
1041
|
+
get() {
|
|
1042
|
+
return this._dirtyPropsPool.get(s);
|
|
1043
|
+
},
|
|
1044
|
+
set(r) {
|
|
1045
|
+
this._dirtyPropsPool.get(s) !== r && this.dirty(), this._dirtyPropsPool.set(s, r);
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
);
|
|
1049
|
+
};
|
|
1050
|
+
}
|
|
1051
|
+
class wt {
|
|
1052
|
+
constructor() {
|
|
1053
|
+
this._dirty = !0, this._disposed = !1, this._dirtyPropsPool = /* @__PURE__ */ new Map();
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* 脏处理
|
|
1057
|
+
*/
|
|
1058
|
+
dirty() {
|
|
1059
|
+
this._dirty = !0;
|
|
1060
|
+
}
|
|
1061
|
+
/**
|
|
1062
|
+
* 清理脏
|
|
1063
|
+
*/
|
|
1064
|
+
unDirty() {
|
|
1065
|
+
this._dirty = !1;
|
|
1066
|
+
}
|
|
1067
|
+
/**
|
|
1068
|
+
* 是否脏
|
|
1069
|
+
* @returns boolean
|
|
1070
|
+
*/
|
|
1071
|
+
isDirty() {
|
|
1072
|
+
return this._dirty;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* 注销
|
|
1076
|
+
*/
|
|
1077
|
+
dispose() {
|
|
1078
|
+
this._disposed = !0, this._dirtyPropsPool.clear();
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* 是否注销
|
|
1082
|
+
* @returns
|
|
1083
|
+
*/
|
|
1084
|
+
isDisposed() {
|
|
1085
|
+
return this._disposed;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
var St = Object.defineProperty, Mt = (n, t, e, s) => {
|
|
1089
|
+
for (var r = void 0, i = n.length - 1, o; i >= 0; i--)
|
|
1090
|
+
(o = n[i]) && (r = o(t, e, r) || r);
|
|
1091
|
+
return r && St(t, e, r), r;
|
|
1092
|
+
}, T;
|
|
1093
|
+
const st = (T = class extends wt {
|
|
1094
|
+
constructor() {
|
|
1095
|
+
super(), this.id = ++T._dID;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* 统一判断当前对象是否应该显示。
|
|
1099
|
+
*/
|
|
1100
|
+
testVisible() {
|
|
1101
|
+
return (this.visible != null ? this.visible : !0) && this.visibleCheck();
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* 给子类补充额外显示条件。
|
|
1105
|
+
*/
|
|
1106
|
+
visibleCheck() {
|
|
1107
|
+
return !0;
|
|
1108
|
+
}
|
|
1109
|
+
onBeforeRender(t = !1) {
|
|
1110
|
+
if (t || this.isDirty()) {
|
|
1111
|
+
const e = this.onRender();
|
|
1112
|
+
return this.unDirty(), e;
|
|
1113
|
+
}
|
|
1114
|
+
return null;
|
|
1115
|
+
}
|
|
1116
|
+
onRender() {
|
|
1117
|
+
return null;
|
|
1118
|
+
}
|
|
1119
|
+
dispose() {
|
|
1120
|
+
super.dispose();
|
|
1121
|
+
}
|
|
1122
|
+
}, T._dID = 0, T);
|
|
1123
|
+
Mt([
|
|
1124
|
+
et()
|
|
1125
|
+
], st.prototype, "visible");
|
|
1126
|
+
let Tt = st;
|
|
1127
|
+
var Lt = Object.defineProperty, vt = (n, t, e, s) => {
|
|
1128
|
+
for (var r = void 0, i = n.length - 1, o; i >= 0; i--)
|
|
1129
|
+
(o = n[i]) && (r = o(t, e, r) || r);
|
|
1130
|
+
return r && Lt(t, e, r), r;
|
|
1131
|
+
};
|
|
1132
|
+
class U extends Tt {
|
|
1133
|
+
getGRep() {
|
|
1134
|
+
return this.gRep;
|
|
1135
|
+
}
|
|
1136
|
+
onRender() {
|
|
1137
|
+
return { gRep: this.gRep };
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
vt([
|
|
1141
|
+
et()
|
|
1142
|
+
], U.prototype, "gRep");
|
|
1143
|
+
class Rt {
|
|
1144
|
+
drawActives(t) {
|
|
1145
|
+
throw new Error("Method not implemented.");
|
|
1146
|
+
}
|
|
1147
|
+
clearActive() {
|
|
1148
|
+
throw new Error("Method not implemented.");
|
|
1149
|
+
}
|
|
1150
|
+
clearSelection() {
|
|
1151
|
+
throw new Error("Method not implemented.");
|
|
1152
|
+
}
|
|
1153
|
+
drawSelections(t) {
|
|
1154
|
+
throw new Error("Method not implemented.");
|
|
1155
|
+
}
|
|
1156
|
+
updateView() {
|
|
1157
|
+
throw new Error("Method not implemented.");
|
|
1158
|
+
}
|
|
1159
|
+
updateImmediately() {
|
|
1160
|
+
throw new Error("Method not implemented.");
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
class At {
|
|
1164
|
+
constructor() {
|
|
1165
|
+
this.container = /* @__PURE__ */ new Map(), [
|
|
1166
|
+
l.ELEMENT_CREATE,
|
|
1167
|
+
l.ELEMENT_DELETE,
|
|
1168
|
+
l.ELEMENT_UPDATE
|
|
1169
|
+
].forEach((e) => this.container.set(e, /* @__PURE__ */ new Set()));
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* 是否发生改变
|
|
1173
|
+
*/
|
|
1174
|
+
isChange() {
|
|
1175
|
+
for (const t of this.container.values())
|
|
1176
|
+
if (t.size) return !0;
|
|
1177
|
+
return this.selection || this.highLight;
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* 缓存变化的Element
|
|
1181
|
+
* 先删+更新/创建 = 更新
|
|
1182
|
+
* 更新/创建+删除 = 删除
|
|
1183
|
+
*/
|
|
1184
|
+
cacheElementChanged(t, e) {
|
|
1185
|
+
const s = e.filter((o) => !o.dontShowView()), r = this.container.get(l.ELEMENT_UPDATE), i = this.container.get(l.ELEMENT_DELETE);
|
|
1186
|
+
l.ELEMENT_CREATE === t || l.ELEMENT_UPDATE === t ? s.forEach((o) => {
|
|
1187
|
+
i?.has(o.id.asInt()) && i.delete(o.id.asInt()), r?.add(o.id.asInt());
|
|
1188
|
+
}) : l.ELEMENT_DELETE === t && s.forEach((o) => {
|
|
1189
|
+
r?.has(o.id.asInt()) && r.delete(o.id.asInt()), i?.add(o.id.asInt());
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* 缓存高亮
|
|
1194
|
+
*/
|
|
1195
|
+
cacheHighLight(t) {
|
|
1196
|
+
this.highLight = t;
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* 缓存选择集
|
|
1200
|
+
*/
|
|
1201
|
+
cacheSelection(t) {
|
|
1202
|
+
this.selection = t;
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* 清空缓存
|
|
1206
|
+
*/
|
|
1207
|
+
clear() {
|
|
1208
|
+
for (const t of this.container.values())
|
|
1209
|
+
t.clear();
|
|
1210
|
+
delete this.highLight, delete this.selection;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
var rt = /* @__PURE__ */ ((n) => (n.Left = "left", n.Center = "center", n.Right = "right", n))(rt || {}), it = /* @__PURE__ */ ((n) => (n.Top = "top", n.Middle = "middle", n.Bottom = "bottom", n))(it || {});
|
|
1214
|
+
const p = class p {
|
|
1215
|
+
static mergeStateStyle(t = {}, e = {}) {
|
|
1216
|
+
return {
|
|
1217
|
+
point: { ...t.point, ...e.point },
|
|
1218
|
+
line: { ...t.line, ...e.line },
|
|
1219
|
+
face: { ...t.face, ...e.face },
|
|
1220
|
+
text: { ...t.text, ...e.text }
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
static _isValidNumber(t) {
|
|
1224
|
+
return typeof t == "number" && Number.isFinite(t);
|
|
1225
|
+
}
|
|
1226
|
+
static _isValidColor(t) {
|
|
1227
|
+
return typeof t == "number" || typeof t == "string";
|
|
1228
|
+
}
|
|
1229
|
+
static getPointStyle(t = {}) {
|
|
1230
|
+
const e = t.point;
|
|
1231
|
+
return {
|
|
1232
|
+
point: {
|
|
1233
|
+
opacity: this._isValidNumber(e?.opacity) ? e.opacity : this.default_opacity,
|
|
1234
|
+
size: this._isValidNumber(e?.size) ? e.size : this.default_point_size,
|
|
1235
|
+
color: this._isValidColor(e?.color) ? e.color : this.default_point_color
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
static getLineStyle(t = {}) {
|
|
1240
|
+
const e = t.line;
|
|
1241
|
+
return {
|
|
1242
|
+
line: {
|
|
1243
|
+
opacity: this._isValidNumber(e?.opacity) ? e.opacity : this.default_opacity,
|
|
1244
|
+
width: this._isValidNumber(e?.width) ? e.width : this.default_line_width,
|
|
1245
|
+
color: this._isValidColor(e?.color) ? e.color : this.default_line_color
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
static getFaceStyle(t = {}) {
|
|
1250
|
+
const e = t.face;
|
|
1251
|
+
return {
|
|
1252
|
+
face: {
|
|
1253
|
+
opacity: this._isValidNumber(e?.opacity) ? e.opacity : this.default_opacity,
|
|
1254
|
+
color: this._isValidColor(e?.color) ? e.color : this.default_face_color
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
static getTextStyle(t = {}) {
|
|
1259
|
+
const e = t.text;
|
|
1260
|
+
return {
|
|
1261
|
+
text: {
|
|
1262
|
+
color: this._isValidColor(e?.color) ? e.color : this.default_text_color,
|
|
1263
|
+
fontSize: this._isValidNumber(e?.fontSize) ? e.fontSize : this.default_text_fontSize,
|
|
1264
|
+
anchorX: e?.anchorX !== void 0 ? e.anchorX : this.default_text_anchorX,
|
|
1265
|
+
anchorY: e?.anchorY !== void 0 ? e.anchorY : this.default_text_anchorY
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1270
|
+
p.default_opacity = 1, p.default_point_color = 16777215, p.default_point_size = 8, p.default_line_color = 16777215, p.default_line_width = 2, p.default_face_color = 16777215, p.default_text_color = 16777215, p.default_text_fontSize = 16, p.default_text_anchorX = rt.Center, p.default_text_anchorY = it.Middle, p.defaultActiveStyle = {
|
|
1271
|
+
point: { color: 16738304 },
|
|
1272
|
+
line: { color: 16738304 },
|
|
1273
|
+
face: { color: 16738304 },
|
|
1274
|
+
text: { color: 16738304 }
|
|
1275
|
+
}, p.defaultSelectionStyle = {
|
|
1276
|
+
point: { color: 16729344 },
|
|
1277
|
+
line: { color: 16729344 },
|
|
1278
|
+
face: { color: 16729344 },
|
|
1279
|
+
text: { color: 16729344 }
|
|
1280
|
+
};
|
|
1281
|
+
let h = p;
|
|
1282
|
+
class It {
|
|
1283
|
+
constructor(t) {
|
|
1284
|
+
this._renderDirty = !0, this.iRender = new Rt(), this.cacheForView = new At(), this._eid2didMap = /* @__PURE__ */ new Map(), this._doc = t;
|
|
1285
|
+
}
|
|
1286
|
+
updateView(t = !1) {
|
|
1287
|
+
if (t) {
|
|
1288
|
+
this.iRender.clearSelection(), this.iRender.clearActive(), this.generateAll(), this.iRender.updateImmediately(), this.cacheForView.clear();
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
this.cacheForView.isChange() && (this._renderDirty = !1, this._updateElements(), this._updateSelection(), this._updateHighLight(), this._renderDirty && this.iRender.updateView(), this.cacheForView.clear());
|
|
1292
|
+
}
|
|
1293
|
+
generateAll() {
|
|
1294
|
+
this.clearAll();
|
|
1295
|
+
for (const t of this._doc.filterElements()) {
|
|
1296
|
+
if (!this._isElementValid(t))
|
|
1297
|
+
continue;
|
|
1298
|
+
const e = t.getGRep();
|
|
1299
|
+
e && this._addGRep(e);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* 清空modelview
|
|
1304
|
+
*/
|
|
1305
|
+
clearAll() {
|
|
1306
|
+
this._eid2didMap.forEach((t, e) => this._removeGRep(e)), this._eid2didMap.clear();
|
|
1307
|
+
}
|
|
1308
|
+
_updateElements() {
|
|
1309
|
+
const { container: t } = this.cacheForView, e = t.get(l.ELEMENT_CREATE)?.keys(), s = t.get(l.ELEMENT_UPDATE)?.keys(), r = t.get(l.ELEMENT_DELETE)?.keys();
|
|
1310
|
+
if (!(!e || !s || !r)) {
|
|
1311
|
+
for (const i of e) {
|
|
1312
|
+
const o = this._doc.getElementById(i);
|
|
1313
|
+
!o || !this._isElementValid(o) || this._addGRep(o.getGRep());
|
|
1314
|
+
}
|
|
1315
|
+
for (const i of s) {
|
|
1316
|
+
const o = this._doc.getElementById(i);
|
|
1317
|
+
if (!o) continue;
|
|
1318
|
+
const a = o.getGRep();
|
|
1319
|
+
this._isElementValid(o) ? this._updateGRep(a) : this._removeGRep(i);
|
|
1320
|
+
}
|
|
1321
|
+
for (const i of r)
|
|
1322
|
+
this._removeGRep(i);
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
/**
|
|
1326
|
+
* 元素是否有效可显示
|
|
1327
|
+
*/
|
|
1328
|
+
_isElementValid(t) {
|
|
1329
|
+
if (t.dontShowView()) return !1;
|
|
1330
|
+
const e = t.getGRep();
|
|
1331
|
+
return e && !e.isEmpty() && t.isElementVisible();
|
|
1332
|
+
}
|
|
1333
|
+
_addGRep(t) {
|
|
1334
|
+
const e = t.elementId.asInt(), s = new U();
|
|
1335
|
+
s.gRep = t, s.eId = e, this._eid2didMap.set(e, s.id), L.instance().addDisplay(s), this._renderDirty = !0;
|
|
1336
|
+
}
|
|
1337
|
+
_updateGRep(t) {
|
|
1338
|
+
const e = t.elementId.asInt(), s = this._eid2didMap.get(e);
|
|
1339
|
+
let r;
|
|
1340
|
+
s ? (r = L.instance().getDisplay(s), d.assert(r, "未查询到display", "wg", "2026-03-12")) : (r = new U(), L.instance().addDisplay(r), this._eid2didMap.set(e, r.id)), r.gRep = t, r.eId = e, this._renderDirty = !0;
|
|
1341
|
+
}
|
|
1342
|
+
_removeGRep(t) {
|
|
1343
|
+
const e = this._eid2didMap.get(t);
|
|
1344
|
+
e && (L.instance().removeDisplayById(e), this._eid2didMap.delete(t), this._renderDirty = !0);
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* 刷新选择集
|
|
1348
|
+
*/
|
|
1349
|
+
_updateSelection() {
|
|
1350
|
+
const { selection: t } = this.cacheForView;
|
|
1351
|
+
if (!t) return;
|
|
1352
|
+
const e = this._toGReps(t.getSelectedElements(), t.getSelectedGNodes(), !0);
|
|
1353
|
+
this.iRender.clearSelection(), this._renderDirty = !0, e.length && this.iRender.drawSelections(e);
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* 刷新高亮集合
|
|
1357
|
+
*/
|
|
1358
|
+
_updateHighLight() {
|
|
1359
|
+
const { highLight: t } = this.cacheForView;
|
|
1360
|
+
if (!t) return;
|
|
1361
|
+
const e = t.getActiveElements(), s = t.getActiveGNodes();
|
|
1362
|
+
this.iRender.clearActive(), this._renderDirty = !0;
|
|
1363
|
+
const r = this._toGReps(e, s, !1);
|
|
1364
|
+
r.length && this.iRender.drawActives(r);
|
|
1365
|
+
}
|
|
1366
|
+
/**
|
|
1367
|
+
* 高亮选中对象转grep
|
|
1368
|
+
*/
|
|
1369
|
+
_toGReps(t, e, s) {
|
|
1370
|
+
const r = [];
|
|
1371
|
+
t.forEach((o) => {
|
|
1372
|
+
const a = s ? o.getGRepWhenSelected() : o.getGRepWhenActive();
|
|
1373
|
+
a.isEmpty() || r.push(a);
|
|
1374
|
+
});
|
|
1375
|
+
const i = new g();
|
|
1376
|
+
return e.forEach((o) => {
|
|
1377
|
+
const a = o.globalMatrix?.clone(), c = o.clone();
|
|
1378
|
+
c.setLocalMatrix(a);
|
|
1379
|
+
const y = s ? h.defaultSelectionStyle : h.defaultActiveStyle;
|
|
1380
|
+
c.setStyle(h.mergeStateStyle(c.getStyle(), y)), i.addNode(c);
|
|
1381
|
+
}), i.updateGlobalMatrix(), r.push(i), r;
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
class X {
|
|
1385
|
+
constructor(t) {
|
|
1386
|
+
this._doc = t;
|
|
1387
|
+
}
|
|
1388
|
+
dump() {
|
|
1389
|
+
const t = {
|
|
1390
|
+
id: this._doc.id
|
|
1391
|
+
};
|
|
1392
|
+
return t.doc = this._dumpDoc(), t;
|
|
1393
|
+
}
|
|
1394
|
+
_dumpDoc() {
|
|
1395
|
+
return this._doc.filterElements().filter((e) => !e.dontSave()).map((e) => ({
|
|
1396
|
+
ctor: e.getSerialId(),
|
|
1397
|
+
...e.dump()
|
|
1398
|
+
}));
|
|
1399
|
+
}
|
|
1400
|
+
/**
|
|
1401
|
+
* 同步加载
|
|
1402
|
+
*/
|
|
1403
|
+
syncLoad(t) {
|
|
1404
|
+
try {
|
|
1405
|
+
const e = new S(this._doc, "open doc file");
|
|
1406
|
+
return e.canUndo = !1, this._clearDocument(), this._fillDocument(t), this._doc.filterElements().forEach((r) => r.onLoad()), e.commit(), !0;
|
|
1407
|
+
} catch {
|
|
1408
|
+
d.warn(!1, "parsing saved doc failed", "wg", "2026-03-30");
|
|
1409
|
+
}
|
|
1410
|
+
return !1;
|
|
1411
|
+
}
|
|
1412
|
+
_clearDocument() {
|
|
1413
|
+
this._doc.filterElements((e) => !e.dontSave()).forEach((e) => {
|
|
1414
|
+
this._doc.elementMgr.delete(e.id.asInt());
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
_fillDocument(t) {
|
|
1418
|
+
const e = [];
|
|
1419
|
+
if (t.doc) {
|
|
1420
|
+
if (t.doc.forEach((s) => {
|
|
1421
|
+
const r = this._doc.elementMgr.getElementClsByCtor(s.ctor);
|
|
1422
|
+
d.assert(r, `cant find element ctor ${s.ctor}`, "wg", "2026-03-30"), E.canCreate = !0;
|
|
1423
|
+
const i = new r();
|
|
1424
|
+
i.setDoc(this._doc), i.load(s), e.push(i), E.canCreate = !1;
|
|
1425
|
+
}), e.forEach((s) => this._doc.elementMgr.add(s)), this._doc.transactionMgr.getCurrentUndoRedoEntity().onElementsAdded(e), e.length) {
|
|
1426
|
+
const s = Math.max(...e.map((r) => r.id.asInt()));
|
|
1427
|
+
this._doc.idPool.clearStableId(s);
|
|
1428
|
+
}
|
|
1429
|
+
return this._doc.id = t.id, e;
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
const A = class A {
|
|
1434
|
+
constructor() {
|
|
1435
|
+
this.isMainDoc = !1, this.idPool = new G(), this.elementMgr = Z, this.requestMgr = Y, this._id = ut.uuid(), this.transactionMgr = new ft(), this.transactionMgr.init(this), this.requestMgr.init(this), this.modelView = new It(this);
|
|
1436
|
+
}
|
|
1437
|
+
get id() {
|
|
1438
|
+
return this._id;
|
|
1439
|
+
}
|
|
1440
|
+
set id(t) {
|
|
1441
|
+
this._id = t;
|
|
1442
|
+
}
|
|
1443
|
+
create(t) {
|
|
1444
|
+
A.canCreate = !0;
|
|
1445
|
+
const e = new t();
|
|
1446
|
+
e.setDoc(this);
|
|
1447
|
+
let s = this.idPool.genId(e);
|
|
1448
|
+
if (!s) {
|
|
1449
|
+
const r = this.transactionMgr.idPoolGC();
|
|
1450
|
+
this.elementMgr.getAllElementIds().forEach((i) => r.add(i)), this.idPool.reset(r), s = this.idPool.genId(e);
|
|
1451
|
+
}
|
|
1452
|
+
return d.assert(s, "Id资源已耗尽", "wg", "2026-03-05"), e.id = s, A.canCreate = !1, d.assert(!this.getElementById(e.id), "该Id已存在", "wg", "2026-03-05"), e.isTemporary() || (this.checkIfCanModifyDoc(), this.transactionMgr.getCurrentUndoRedoEntity().onElementsAdded([e])), this.elementMgr.add(e), e;
|
|
1453
|
+
}
|
|
1454
|
+
deleteElementsById(...t) {
|
|
1455
|
+
const e = this.getElementsByIds(t);
|
|
1456
|
+
return e.length ? (e.some((s) => !s.isTemporary()) && (this.checkIfCanModifyDoc(), this.transactionMgr.getCurrentUndoRedoEntity().onElementsDeleted(e)), e.forEach((s) => {
|
|
1457
|
+
this.elementMgr.delete(s.id.asInt());
|
|
1458
|
+
}), this.cacheForViewElementChanged(l.ELEMENT_DELETE, e), !0) : !1;
|
|
1459
|
+
}
|
|
1460
|
+
getElementById(t) {
|
|
1461
|
+
const e = t instanceof m ? t.asInt() : t;
|
|
1462
|
+
return this.elementMgr.getElementById(e);
|
|
1463
|
+
}
|
|
1464
|
+
getElementByIdEnsure(t) {
|
|
1465
|
+
const e = t instanceof m ? t.asInt() : t, s = this.getElementById(e);
|
|
1466
|
+
return d.assert(s, `${e}不存在`, "wg", "2026-03-05"), s;
|
|
1467
|
+
}
|
|
1468
|
+
getElementsByIds(t) {
|
|
1469
|
+
const e = [];
|
|
1470
|
+
return t.forEach((s) => {
|
|
1471
|
+
const r = this.getElementById(s);
|
|
1472
|
+
r && e.push(r);
|
|
1473
|
+
}), e;
|
|
1474
|
+
}
|
|
1475
|
+
// public getElementClsByCtor(ctor:string) {
|
|
1476
|
+
// return this
|
|
1477
|
+
// }
|
|
1478
|
+
filterElements(t) {
|
|
1479
|
+
return t ? this.elementMgr.getAllElements().filter(t) : this.elementMgr.getAllElements();
|
|
1480
|
+
}
|
|
1481
|
+
checkIfCanModifyDoc() {
|
|
1482
|
+
d.assert(this.transactionMgr.getCurrentTransaction(), "事务外不可修改文档", "wg", "2025-11-18");
|
|
1483
|
+
}
|
|
1484
|
+
cacheForViewElementChanged(t, e) {
|
|
1485
|
+
this.modelView.cacheForView.cacheElementChanged(t, e);
|
|
1486
|
+
}
|
|
1487
|
+
updateView(t = !1) {
|
|
1488
|
+
return this.modelView.updateView(t), !0;
|
|
1489
|
+
}
|
|
1490
|
+
dump() {
|
|
1491
|
+
return new X(this).dump();
|
|
1492
|
+
}
|
|
1493
|
+
load(t) {
|
|
1494
|
+
return new X(this).syncLoad(t), this;
|
|
1495
|
+
}
|
|
1496
|
+
// TODO 补充完整
|
|
1497
|
+
destroy() {
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
A.canCreate = !1;
|
|
1501
|
+
let E = A;
|
|
1502
|
+
class Ct {
|
|
1503
|
+
constructor() {
|
|
1504
|
+
this._db = {}, this._cache = {};
|
|
1505
|
+
}
|
|
1506
|
+
get db() {
|
|
1507
|
+
return this._db;
|
|
1508
|
+
}
|
|
1509
|
+
get cache() {
|
|
1510
|
+
return this._cache;
|
|
1511
|
+
}
|
|
1512
|
+
/**
|
|
1513
|
+
* 获取修改的数据
|
|
1514
|
+
*/
|
|
1515
|
+
getModified() {
|
|
1516
|
+
const t = [];
|
|
1517
|
+
for (const e in this._cache)
|
|
1518
|
+
t.push({
|
|
1519
|
+
propertyName: e,
|
|
1520
|
+
oldValue: this._db[e],
|
|
1521
|
+
newValue: this._cache[e]
|
|
1522
|
+
});
|
|
1523
|
+
return t;
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* 数据入库
|
|
1527
|
+
*/
|
|
1528
|
+
commit() {
|
|
1529
|
+
for (const t in this._cache)
|
|
1530
|
+
this.db[t] = this._cache[t];
|
|
1531
|
+
this._clearCache();
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* 数据回滚
|
|
1535
|
+
*/
|
|
1536
|
+
rollBack() {
|
|
1537
|
+
this._clearCache();
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* 清空缓存
|
|
1541
|
+
*/
|
|
1542
|
+
_clearCache() {
|
|
1543
|
+
this._cache = {};
|
|
1544
|
+
}
|
|
1545
|
+
ownKeys() {
|
|
1546
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(this._db), ...Object.keys(this._cache)])];
|
|
1547
|
+
}
|
|
1548
|
+
dump() {
|
|
1549
|
+
return Object.keys(this._cache).length ? {
|
|
1550
|
+
...this._dumpData(this._db),
|
|
1551
|
+
...this._dumpData(this._cache)
|
|
1552
|
+
} : this._dumpData(this._db);
|
|
1553
|
+
}
|
|
1554
|
+
load(t) {
|
|
1555
|
+
const e = this._db;
|
|
1556
|
+
for (const s of this.ownKeys()) {
|
|
1557
|
+
if (s.startsWith(v.UNDER_SCORE) || s.startsWith(v.C_UNDER_SCORE))
|
|
1558
|
+
continue;
|
|
1559
|
+
const r = e[s], i = t[s];
|
|
1560
|
+
if (i != null)
|
|
1561
|
+
if (Array.isArray(r)) {
|
|
1562
|
+
const o = r[0];
|
|
1563
|
+
e[s] = this._loadArr(i, o);
|
|
1564
|
+
} else if (r instanceof Map)
|
|
1565
|
+
e[s] = this._loadMap(i, r);
|
|
1566
|
+
else if (r instanceof Set) {
|
|
1567
|
+
const o = [...r.values()];
|
|
1568
|
+
e[s] = this._loadSet(i, o);
|
|
1569
|
+
} else if (this._isDumpLoad(r)) {
|
|
1570
|
+
const o = new r.constructor();
|
|
1571
|
+
o.load(i), e[s] = o;
|
|
1572
|
+
} else r === N ? e[s] = W.load(i) : e[s] = i;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
_dumpData(t) {
|
|
1576
|
+
E.canCreate = !0;
|
|
1577
|
+
const e = new this.constructor();
|
|
1578
|
+
E.canCreate = !1;
|
|
1579
|
+
const s = {};
|
|
1580
|
+
return Object.keys(t).forEach((r) => {
|
|
1581
|
+
if (r.startsWith(v.UNDER_SCORE) || r.startsWith(v.C_UNDER_SCORE))
|
|
1582
|
+
return;
|
|
1583
|
+
const i = e[r], o = t[r];
|
|
1584
|
+
if (Array.isArray(o)) {
|
|
1585
|
+
const a = this._dumpArr(i), c = this._dumpArr(o);
|
|
1586
|
+
if (JSON.stringify(a) === JSON.stringify(c)) return;
|
|
1587
|
+
s[r] = c;
|
|
1588
|
+
} else if (o instanceof Map) {
|
|
1589
|
+
const a = this._dumpMap(i), c = this._dumpMap(o);
|
|
1590
|
+
if (JSON.stringify(a) === JSON.stringify(c)) return;
|
|
1591
|
+
s[r] = c;
|
|
1592
|
+
} else if (o instanceof Set) {
|
|
1593
|
+
const a = this._dumpSet(i), c = this._dumpSet(o);
|
|
1594
|
+
if (JSON.stringify(a) === JSON.stringify(c)) return;
|
|
1595
|
+
s[r] = c;
|
|
1596
|
+
} else {
|
|
1597
|
+
const a = this._dumpAProperty(i), c = this._dumpAProperty(o);
|
|
1598
|
+
if (JSON.stringify(a) === JSON.stringify(c)) return;
|
|
1599
|
+
s[r] = c;
|
|
1600
|
+
}
|
|
1601
|
+
}), s;
|
|
1602
|
+
}
|
|
1603
|
+
_dumpArr(t) {
|
|
1604
|
+
const e = [...t];
|
|
1605
|
+
for (let s = 0; s < e.length; s += 1) {
|
|
1606
|
+
const r = t[s];
|
|
1607
|
+
r instanceof Array ? e[s] = this._dumpArr(r) : e[s] = this._dumpAProperty(r);
|
|
1608
|
+
}
|
|
1609
|
+
return e;
|
|
1610
|
+
}
|
|
1611
|
+
/**
|
|
1612
|
+
* 加载数组
|
|
1613
|
+
* @param arr JSON中的数组
|
|
1614
|
+
* @param first 参考数组中的第一个值
|
|
1615
|
+
* 数组中元素当前只支持dump、load对象和基础类型
|
|
1616
|
+
*/
|
|
1617
|
+
_loadArr(t, e) {
|
|
1618
|
+
return t.length ? Array.isArray(e) ? t.map((s) => this._loadArr(s, e[0])) : t.map((s) => {
|
|
1619
|
+
if (this._isDumpLoad(e)) {
|
|
1620
|
+
const r = e.constructor, i = new r();
|
|
1621
|
+
return i.load(s), i;
|
|
1622
|
+
} else {
|
|
1623
|
+
if (e === N)
|
|
1624
|
+
return W.load(s);
|
|
1625
|
+
{
|
|
1626
|
+
const r = typeof s;
|
|
1627
|
+
if (r === "string" || r === "boolean" || r === "number")
|
|
1628
|
+
return s;
|
|
1629
|
+
d.assert(!1, "暂不支持的类型", "wg", "2026-03-29");
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
}) : [];
|
|
1633
|
+
}
|
|
1634
|
+
_dumpMap(t) {
|
|
1635
|
+
const e = [...t];
|
|
1636
|
+
for (let s = 0; s < e.length; s += 1) {
|
|
1637
|
+
const r = this._dumpArr(e[s]);
|
|
1638
|
+
e[s] = r;
|
|
1639
|
+
}
|
|
1640
|
+
return this._dumpArr(e);
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Map中的元素支持dump、load对象和基础元素类型
|
|
1644
|
+
*/
|
|
1645
|
+
_loadMap(t, e) {
|
|
1646
|
+
e.size || d.assert(!1, "DB数据需要提供初始值", "wg", "2026-03-29");
|
|
1647
|
+
const s = /* @__PURE__ */ new Map();
|
|
1648
|
+
for (const [r, i] of t) {
|
|
1649
|
+
const o = e.get(r);
|
|
1650
|
+
if (this._isDumpLoad(o)) {
|
|
1651
|
+
const a = new o.constructor();
|
|
1652
|
+
a.load(i), s.set(r, a);
|
|
1653
|
+
} else this._isBasicType(o) ? s.set(r, i) : d.assert(!1, "不支持的类型", "wg", "2026-03-29");
|
|
1654
|
+
}
|
|
1655
|
+
return s;
|
|
1656
|
+
}
|
|
1657
|
+
_dumpSet(t) {
|
|
1658
|
+
const e = [...t];
|
|
1659
|
+
return this._dumpArr(e);
|
|
1660
|
+
}
|
|
1661
|
+
/**
|
|
1662
|
+
* 当前Set只支持里面所有元素为同一类型
|
|
1663
|
+
*/
|
|
1664
|
+
_loadSet(t, e) {
|
|
1665
|
+
const s = /* @__PURE__ */ new Set();
|
|
1666
|
+
for (const r of t)
|
|
1667
|
+
if (this._isDumpLoad(e)) {
|
|
1668
|
+
const i = e.constructor, o = new i();
|
|
1669
|
+
o.load(r), s.add(o);
|
|
1670
|
+
} else this._isBasicType(e) ? s.add(r) : d.assert(!1, "不支持的数据类型", "wg", "2026-03-29");
|
|
1671
|
+
return s;
|
|
1672
|
+
}
|
|
1673
|
+
_dumpAProperty(t) {
|
|
1674
|
+
if (this._isBasicType(t))
|
|
1675
|
+
return t;
|
|
1676
|
+
if (this._isDumpLoad(t))
|
|
1677
|
+
return t.dump();
|
|
1678
|
+
(t instanceof Array || t instanceof Map || t instanceof Set) && d.assert(!1, "不支持的数据类型", "wg", "2026-03-27");
|
|
1679
|
+
}
|
|
1680
|
+
_isDumpLoad(t) {
|
|
1681
|
+
return !!t && t.dump instanceof Function && t.load instanceof Function;
|
|
1682
|
+
}
|
|
1683
|
+
_isBasicType(t) {
|
|
1684
|
+
const e = typeof t;
|
|
1685
|
+
return e === "string" || e === "number" || e === "boolean";
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
class xt extends Ct {
|
|
1689
|
+
constructor() {
|
|
1690
|
+
super(), this.id = m.INVALID, this.name = "", this.visible = !0, this.C_GRep = g.empty, d.assert(E.canCreate, "创建Element必须通过Document.create方法", "wg", "2025-11-18");
|
|
1691
|
+
}
|
|
1692
|
+
getDoc() {
|
|
1693
|
+
return this._doc;
|
|
1694
|
+
}
|
|
1695
|
+
setDoc(t) {
|
|
1696
|
+
this._doc = t;
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* 空构造+初始化
|
|
1700
|
+
*/
|
|
1701
|
+
init(...t) {
|
|
1702
|
+
return this;
|
|
1703
|
+
}
|
|
1704
|
+
/**
|
|
1705
|
+
* 获取序列化的id
|
|
1706
|
+
*/
|
|
1707
|
+
getSerialId() {
|
|
1708
|
+
return this.constructor.serializedId.ctor;
|
|
1709
|
+
}
|
|
1710
|
+
/**
|
|
1711
|
+
* 重置缓存的 GRep,强制后续重新生成图形表示。
|
|
1712
|
+
*/
|
|
1713
|
+
markGRepDirty() {
|
|
1714
|
+
this.C_GRep = new g();
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* 获取GRep显示对象
|
|
1718
|
+
*/
|
|
1719
|
+
getGRep() {
|
|
1720
|
+
const t = this.C_GRep;
|
|
1721
|
+
return t.elementId.isValid() || (t.elementId = this.id), t;
|
|
1722
|
+
}
|
|
1723
|
+
getGRepWhenSelected() {
|
|
1724
|
+
const t = this.getGRep();
|
|
1725
|
+
if (!t || t.isEmpty())
|
|
1726
|
+
return new g();
|
|
1727
|
+
const e = t.clone();
|
|
1728
|
+
return e.traverse((s) => {
|
|
1729
|
+
s.setStyle(h.mergeStateStyle(s.getStyle(), h.defaultSelectionStyle));
|
|
1730
|
+
}), e;
|
|
1731
|
+
}
|
|
1732
|
+
getGRepWhenActive() {
|
|
1733
|
+
const t = this.getGRep();
|
|
1734
|
+
if (!t || t.isEmpty())
|
|
1735
|
+
return new g();
|
|
1736
|
+
const e = t.clone();
|
|
1737
|
+
return e.traverse((s) => {
|
|
1738
|
+
s.setStyle(h.mergeStateStyle(s.getStyle(), h.defaultActiveStyle));
|
|
1739
|
+
}), e;
|
|
1740
|
+
}
|
|
1741
|
+
/**
|
|
1742
|
+
* 设置GRep显示对象
|
|
1743
|
+
*/
|
|
1744
|
+
setGRep(t) {
|
|
1745
|
+
return t.elementId = this.id, this.C_GRep === t && t.clearRenderNode(), this.C_GRep = t, !0;
|
|
1746
|
+
}
|
|
1747
|
+
isElementVisible() {
|
|
1748
|
+
return this.visible;
|
|
1749
|
+
}
|
|
1750
|
+
/**
|
|
1751
|
+
* 是否为临时对象
|
|
1752
|
+
* 临时对象不受事务监管
|
|
1753
|
+
*/
|
|
1754
|
+
isTemporary() {
|
|
1755
|
+
return !1;
|
|
1756
|
+
}
|
|
1757
|
+
dontSave() {
|
|
1758
|
+
return !1;
|
|
1759
|
+
}
|
|
1760
|
+
dontShowView() {
|
|
1761
|
+
return !1;
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* 属性变化是否应该缓存到视图
|
|
1765
|
+
*/
|
|
1766
|
+
propShouldCacheToView(t) {
|
|
1767
|
+
return (t === q.C_GREP || t === q.VISIBLE) && !this.dontShowView();
|
|
1768
|
+
}
|
|
1769
|
+
clone() {
|
|
1770
|
+
const t = this._doc.create(this.constructor), e = this.dump();
|
|
1771
|
+
return delete e.id, t.load(e), t;
|
|
1772
|
+
}
|
|
1773
|
+
onLoad() {
|
|
1774
|
+
this.markGRepDirty();
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
const Nt = (n) => function(t) {
|
|
1778
|
+
t.serializedId = {
|
|
1779
|
+
ctor: n
|
|
1780
|
+
}, Z.registerElement(n, t), E.canCreate = !0;
|
|
1781
|
+
const e = new t();
|
|
1782
|
+
E.canCreate = !1, Object.keys(e).filter((r) => !r.startsWith("_")).forEach((r) => {
|
|
1783
|
+
Object.defineProperty(t.prototype, r, {
|
|
1784
|
+
set(i) {
|
|
1785
|
+
const o = this.getDoc(), a = o?.getElementById(this.id);
|
|
1786
|
+
a ? (a.isTemporary() ? this.db[r] = i : (o.checkIfCanModifyDoc(), o.transactionMgr.getCurrentUndoRedoEntity().onElementsUpdated([a]), this.cache[r] = i), a.propShouldCacheToView(r) && o.cacheForViewElementChanged(l.ELEMENT_UPDATE, [a])) : this.db[r] = i;
|
|
1787
|
+
},
|
|
1788
|
+
get() {
|
|
1789
|
+
return this.cache[r] !== void 0 ? this.cache[r] : this.db[r];
|
|
1790
|
+
}
|
|
1791
|
+
});
|
|
1792
|
+
});
|
|
1793
|
+
};
|
|
1794
|
+
var Dt = Object.getOwnPropertyDescriptor, Vt = (n, t, e, s) => {
|
|
1795
|
+
for (var r = s > 1 ? void 0 : s ? Dt(t, e) : t, i = n.length - 1, o; i >= 0; i--)
|
|
1796
|
+
(o = n[i]) && (r = o(r) || r);
|
|
1797
|
+
return r;
|
|
1798
|
+
};
|
|
1799
|
+
let F = class extends xt {
|
|
1800
|
+
init() {
|
|
1801
|
+
return this;
|
|
1802
|
+
}
|
|
1803
|
+
dontSave() {
|
|
1804
|
+
return !0;
|
|
1805
|
+
}
|
|
1806
|
+
isTemporary() {
|
|
1807
|
+
return !0;
|
|
1808
|
+
}
|
|
1809
|
+
};
|
|
1810
|
+
F = Vt([
|
|
1811
|
+
Nt("7ac53d95-03ae-484d-9bfd-39755e145a8c")
|
|
1812
|
+
], F);
|
|
1813
|
+
class Bt {
|
|
1814
|
+
constructor(t) {
|
|
1815
|
+
this._tmpGRepRemoved = !1, this._doc = t, this._tmpElementId = this._doc.create(F).init().id;
|
|
1816
|
+
}
|
|
1817
|
+
get tmpElement() {
|
|
1818
|
+
const t = this._doc.getElementById(this._tmpElementId);
|
|
1819
|
+
return d.assert(t, "ele为空", "wg", "2026-03-15"), t;
|
|
1820
|
+
}
|
|
1821
|
+
/**
|
|
1822
|
+
* 绘制临时元素
|
|
1823
|
+
*/
|
|
1824
|
+
drawTmpGRep(t) {
|
|
1825
|
+
t.canPick = !1, t.canSnap = !1, this.tmpElement.setGRep(t), this._tmpGRepRemoved = !1;
|
|
1826
|
+
}
|
|
1827
|
+
/**
|
|
1828
|
+
* 清除临时元素
|
|
1829
|
+
*/
|
|
1830
|
+
clearTmp() {
|
|
1831
|
+
this._tmpGRepRemoved || this._doc.getElementById(this._tmpElementId) && (this.drawTmpGRep(g.empty), this._tmpGRepRemoved = !0, this._doc.updateView());
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* 销毁
|
|
1835
|
+
*/
|
|
1836
|
+
destroy() {
|
|
1837
|
+
this.clearTmp(), this._doc.deleteElementsById(this._tmpElementId);
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
class x extends D {
|
|
1841
|
+
constructor(t, e) {
|
|
1842
|
+
super(), this.plane = t.clone(), this.geo = e;
|
|
1843
|
+
}
|
|
1844
|
+
_copyFrom(t) {
|
|
1845
|
+
return super._copyFrom(t), this;
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
class nt extends x {
|
|
1849
|
+
constructor(t, e) {
|
|
1850
|
+
super(t, e);
|
|
1851
|
+
}
|
|
1852
|
+
setStyle(t) {
|
|
1853
|
+
return super.setStyle(t), this._renderNode && (this._renderNode.style = h.getLineStyle(this.getStyle())), this;
|
|
1854
|
+
}
|
|
1855
|
+
getType() {
|
|
1856
|
+
return w.GCurve2d;
|
|
1857
|
+
}
|
|
1858
|
+
// 将二维曲线离散成顺序点列,再映射到所在平面,生成对应的 RenderEdge。
|
|
1859
|
+
// 【与当前实现差异】
|
|
1860
|
+
// 当前完整实现里这里还会同步线样式。
|
|
1861
|
+
// 当前最小化版本未保留 style 体系,因此这里只保留离散后的点数据。
|
|
1862
|
+
_toRenderNodeWithoutMatrix(t) {
|
|
1863
|
+
const e = new tt();
|
|
1864
|
+
return e.points = this.geo.discrete(t).map((s) => this.plane.getPtAt(s)), e.style = h.getLineStyle(this.getStyle()), e;
|
|
1865
|
+
}
|
|
1866
|
+
// 将二维曲线离散并映射为三维顺序点列。
|
|
1867
|
+
discrete(t) {
|
|
1868
|
+
return this.geo.discrete(t).map((e) => this.plane.getPtAt(e));
|
|
1869
|
+
}
|
|
1870
|
+
clone(t) {
|
|
1871
|
+
return new nt(this.plane, t ? this.geo.clone() : this.geo)._copyFrom(this);
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
class ot extends x {
|
|
1875
|
+
constructor(t, e) {
|
|
1876
|
+
super(t, e);
|
|
1877
|
+
}
|
|
1878
|
+
setStyle(t) {
|
|
1879
|
+
return super.setStyle(t), this._renderNode && (this._renderNode.style = h.getLineStyle(this.getStyle())), this;
|
|
1880
|
+
}
|
|
1881
|
+
getType() {
|
|
1882
|
+
return w.GPolycurve;
|
|
1883
|
+
}
|
|
1884
|
+
_toRenderNodeWithoutMatrix(t) {
|
|
1885
|
+
const e = new tt(), s = J.DiscreteTopology.discretePolyline(this.geo, t);
|
|
1886
|
+
return this.geo.getType() === pt.LOOP && s.length > 0 && s.push(s[0].clone()), e.points = s.map((r) => this.plane.getPtAt(r)), e.style = h.getLineStyle(this.getStyle()), e;
|
|
1887
|
+
}
|
|
1888
|
+
clone(t) {
|
|
1889
|
+
return new ot(this.plane, t ? this.geo.clone() : this.geo)._copyFrom(this);
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
class at extends x {
|
|
1893
|
+
constructor(t, e) {
|
|
1894
|
+
super(t, e);
|
|
1895
|
+
}
|
|
1896
|
+
setStyle(t) {
|
|
1897
|
+
return super.setStyle(t), this._renderNode && (this._renderNode.style = h.getPointStyle(this.getStyle())), this;
|
|
1898
|
+
}
|
|
1899
|
+
getType() {
|
|
1900
|
+
return w.GPoint2d;
|
|
1901
|
+
}
|
|
1902
|
+
_toRenderNodeWithoutMatrix() {
|
|
1903
|
+
const t = new gt();
|
|
1904
|
+
return t.point = this.plane.getPtAt(this.geo), t.style = h.getPointStyle(this.getStyle()), t;
|
|
1905
|
+
}
|
|
1906
|
+
// 返回当前二维点映射到平面后的三维坐标。
|
|
1907
|
+
getPoint() {
|
|
1908
|
+
return this.plane.getPtAt(this.geo);
|
|
1909
|
+
}
|
|
1910
|
+
clone(t) {
|
|
1911
|
+
return new at(this.plane, t ? this.geo.clone() : this.geo)._copyFrom(this);
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
class dt extends x {
|
|
1915
|
+
constructor(t, e) {
|
|
1916
|
+
super(t, e);
|
|
1917
|
+
}
|
|
1918
|
+
setStyle(t) {
|
|
1919
|
+
return super.setStyle(t), this._renderNode && (this._renderNode.style = h.getFaceStyle(this.getStyle())), this;
|
|
1920
|
+
}
|
|
1921
|
+
getType() {
|
|
1922
|
+
return w.GPolygon;
|
|
1923
|
+
}
|
|
1924
|
+
_toRenderNodeWithoutMatrix(t) {
|
|
1925
|
+
return this.toRenderNodeForActive(t);
|
|
1926
|
+
}
|
|
1927
|
+
toRenderNodeForActive(t) {
|
|
1928
|
+
const e = new yt();
|
|
1929
|
+
try {
|
|
1930
|
+
const s = J.DiscreteTopology.tessPolygon(this.geo, t), { vertices: r, faces: i } = s;
|
|
1931
|
+
e.setVerts(
|
|
1932
|
+
r.map((a) => this.plane.getPtAt(a))
|
|
1933
|
+
), i && e.setIndices(new Uint32Array(i));
|
|
1934
|
+
const o = [];
|
|
1935
|
+
for (let a = 0; a < r.length; a++)
|
|
1936
|
+
o.push(this.plane.getNorm());
|
|
1937
|
+
e.setNormals(o);
|
|
1938
|
+
} catch (s) {
|
|
1939
|
+
console.error(s), d.warn(!1, "invalid gface", "wg", "2026-03-13");
|
|
1940
|
+
}
|
|
1941
|
+
return e.style = h.getFaceStyle(this.getStyle()), e;
|
|
1942
|
+
}
|
|
1943
|
+
clone(t) {
|
|
1944
|
+
return new dt(this.plane.clone(), t ? this.geo.clone() : this.geo)._copyFrom(this);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
class ct extends x {
|
|
1948
|
+
constructor(t, e, s) {
|
|
1949
|
+
super(e, $.rO()), this.text = t, this.position = $.O(), s && (this.position = s);
|
|
1950
|
+
}
|
|
1951
|
+
setStyle(t) {
|
|
1952
|
+
return super.setStyle(t), this._renderNode && (this._renderNode.style = h.getTextStyle(this.getStyle())), this;
|
|
1953
|
+
}
|
|
1954
|
+
getType() {
|
|
1955
|
+
return w.GText2d;
|
|
1956
|
+
}
|
|
1957
|
+
_toRenderNodeWithoutMatrix() {
|
|
1958
|
+
const t = new mt();
|
|
1959
|
+
return t.text = this.text, t.position = this.position.toXYZ(), t.style = h.getTextStyle(this.getStyle()), t;
|
|
1960
|
+
}
|
|
1961
|
+
clone() {
|
|
1962
|
+
const t = new ct(this.text, this.plane.clone(), this.position);
|
|
1963
|
+
return t._copyFrom(this), t;
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
class Ot {
|
|
1967
|
+
/**
|
|
1968
|
+
* 清空高亮
|
|
1969
|
+
*/
|
|
1970
|
+
clearActive() {
|
|
1971
|
+
}
|
|
1972
|
+
/**
|
|
1973
|
+
* 清空选择集
|
|
1974
|
+
*/
|
|
1975
|
+
clearSelection() {
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
class zt {
|
|
1979
|
+
static flatLeafRNodes(t) {
|
|
1980
|
+
const e = [];
|
|
1981
|
+
return t instanceof z ? (t.children.forEach((s) => {
|
|
1982
|
+
e.push(...this.flatLeafRNodes(s));
|
|
1983
|
+
}), e) : (e.push(t), e);
|
|
1984
|
+
}
|
|
1985
|
+
}
|
|
1986
|
+
class ht {
|
|
1987
|
+
setDoc(t) {
|
|
1988
|
+
this._doc = t;
|
|
1989
|
+
}
|
|
1990
|
+
/**
|
|
1991
|
+
* 是否参与事务记录
|
|
1992
|
+
*/
|
|
1993
|
+
canTransact() {
|
|
1994
|
+
return !0;
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
function lt(n) {
|
|
1998
|
+
return (t) => {
|
|
1999
|
+
Y.registerRequest(n, t);
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
2002
|
+
var bt = Object.getOwnPropertyDescriptor, Pt = (n, t, e, s) => {
|
|
2003
|
+
for (var r = s > 1 ? void 0 : s ? bt(t, e) : t, i = n.length - 1, o; i >= 0; i--)
|
|
2004
|
+
(o = n[i]) && (r = o(r) || r);
|
|
2005
|
+
return r;
|
|
2006
|
+
};
|
|
2007
|
+
let j = class extends ht {
|
|
2008
|
+
execute() {
|
|
2009
|
+
this._doc.transactionMgr.undo(), this._doc.updateView();
|
|
2010
|
+
}
|
|
2011
|
+
canTransact() {
|
|
2012
|
+
return !1;
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
j = Pt([
|
|
2016
|
+
lt(B.UNDO)
|
|
2017
|
+
], j);
|
|
2018
|
+
var Gt = Object.getOwnPropertyDescriptor, Ut = (n, t, e, s) => {
|
|
2019
|
+
for (var r = s > 1 ? void 0 : s ? Gt(t, e) : t, i = n.length - 1, o; i >= 0; i--)
|
|
2020
|
+
(o = n[i]) && (r = o(r) || r);
|
|
2021
|
+
return r;
|
|
2022
|
+
};
|
|
2023
|
+
let K = class extends ht {
|
|
2024
|
+
execute() {
|
|
2025
|
+
this._doc.transactionMgr.redo(), this._doc.updateView();
|
|
2026
|
+
}
|
|
2027
|
+
canTransact() {
|
|
2028
|
+
return !1;
|
|
2029
|
+
}
|
|
2030
|
+
};
|
|
2031
|
+
K = Ut([
|
|
2032
|
+
lt(B.REDO)
|
|
2033
|
+
], K);
|
|
2034
|
+
export {
|
|
2035
|
+
xt as CElement,
|
|
2036
|
+
H as ClassManager,
|
|
2037
|
+
kt as DBGenerator,
|
|
2038
|
+
d as DebugUtil,
|
|
2039
|
+
Tt as DisplayObject,
|
|
2040
|
+
L as DisplayObjectMgr,
|
|
2041
|
+
E as Document,
|
|
2042
|
+
rt as EN_AnchorX,
|
|
2043
|
+
it as EN_AnchorY,
|
|
2044
|
+
B as EN_CoreRequestIds,
|
|
2045
|
+
l as EN_ModelViewChanged,
|
|
2046
|
+
I as EN_RNODE_TYPE,
|
|
2047
|
+
xt as Element,
|
|
2048
|
+
m as ElementId,
|
|
2049
|
+
k as ElementMgr,
|
|
2050
|
+
nt as GCurve2d,
|
|
2051
|
+
V as GGroup,
|
|
2052
|
+
w as GNODE_TYPE,
|
|
2053
|
+
D as GNode,
|
|
2054
|
+
x as GNode2d,
|
|
2055
|
+
at as GPoint2d,
|
|
2056
|
+
ot as GPolycurve,
|
|
2057
|
+
dt as GPolygon,
|
|
2058
|
+
g as GRep,
|
|
2059
|
+
ct as GText2d,
|
|
2060
|
+
U as GrepDisplay,
|
|
2061
|
+
Ot as IRender,
|
|
2062
|
+
N as MathSymbol,
|
|
2063
|
+
It as ModelView,
|
|
2064
|
+
K as RedoRequest,
|
|
2065
|
+
Nt as RegisterElement,
|
|
2066
|
+
tt as RenderEdge,
|
|
2067
|
+
z as RenderGroup,
|
|
2068
|
+
yt as RenderMesh,
|
|
2069
|
+
C as RenderNode,
|
|
2070
|
+
zt as RenderNodeUtil,
|
|
2071
|
+
gt as RenderPoint,
|
|
2072
|
+
mt as RenderText,
|
|
2073
|
+
ht as Request,
|
|
2074
|
+
O as RequestMgr,
|
|
2075
|
+
F as TmpElement,
|
|
2076
|
+
Bt as TmpElementPainter,
|
|
2077
|
+
j as UndoRequest,
|
|
2078
|
+
lt as registerRequest,
|
|
2079
|
+
Y as requestMgr
|
|
2080
|
+
};
|