cesium-pocket 0.3.1-alpha → 0.3.6-alpha
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/{CircleDrawer-DbOS8_ZI.js → CircleDrawer-DotSQduG.js} +184 -175
- package/PolygonGaguger-HRGTFdqB.js +498 -0
- package/README.md +2 -3
- package/drawer.d.ts +2 -2
- package/drawer.js +1 -1
- package/gauger.d.ts +6 -0
- package/gauger.js +8 -0
- package/index.d.ts +1 -0
- package/index.js +7 -1
- package/package.json +5 -1
- package/src/drawer/CP2dDrawer.d.ts +16 -7
- package/src/drawer/CircleDrawer.d.ts +9 -2
- package/src/drawer/DataCenter.d.ts +9 -3
- package/src/drawer/PointDrawer.d.ts +9 -8
- package/src/drawer/RectDrawer.d.ts +9 -1
- package/src/gauger/CircleGaguger.d.ts +30 -0
- package/src/gauger/LineGaguger.d.ts +31 -0
- package/src/gauger/PointGaguger.d.ts +26 -0
- package/src/gauger/PolygonGaguger.d.ts +33 -0
- package/src/gauger/RectGaguger.d.ts +29 -0
- package/src/gauger/util.d.ts +17 -0
- package/logo.svg +0 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CustomDataSource as
|
|
1
|
+
import { CustomDataSource as b, Cartesian3 as r, JulianDate as I, defined as h, HeightReference as m, Color as u, EntityCollection as F, ScreenSpaceEventType as c, ConstantPositionProperty as E, ScreenSpaceEventHandler as y, VerticalOrigin as B, PolylineDashMaterialProperty as M, CallbackProperty as D, PolygonHierarchy as C, Cartographic as v, Transforms as P, Matrix4 as p, EllipsoidGeodesic as R } from "cesium";
|
|
2
2
|
import { toRaw as d } from "vue";
|
|
3
|
-
const
|
|
3
|
+
const l = {
|
|
4
4
|
STOPED: Symbol("STOPED"),
|
|
5
5
|
//未开启状态
|
|
6
6
|
DRAWABLE: Symbol("DRAWABLE"),
|
|
@@ -18,15 +18,15 @@ const h = {
|
|
|
18
18
|
//可拖拽
|
|
19
19
|
DRAGING: Symbol("DRAGING")
|
|
20
20
|
//正在拖拽中
|
|
21
|
-
},
|
|
21
|
+
}, A = {
|
|
22
22
|
DEL_UNABLED: Symbol("DEL_UNABLED"),
|
|
23
23
|
//不删除
|
|
24
24
|
DEL_ENABLED: Symbol("DEL_ENABLED")
|
|
25
25
|
//可拖拽
|
|
26
26
|
};
|
|
27
|
-
class
|
|
27
|
+
class k {
|
|
28
28
|
constructor(e) {
|
|
29
|
-
this.status =
|
|
29
|
+
this.status = l.STOPED, this.editStatus = o.DRAG_UNABLED, this.delStatus = A.DEL_UNABLED, this.viewer = e;
|
|
30
30
|
}
|
|
31
31
|
getStatus() {
|
|
32
32
|
return this.status;
|
|
@@ -47,22 +47,22 @@ class G {
|
|
|
47
47
|
* 可添加点
|
|
48
48
|
*/
|
|
49
49
|
drawableStatus() {
|
|
50
|
-
this.status =
|
|
50
|
+
this.status = l.DRAWABLE, this.viewer.canvas.style.cursor = "crosshair";
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* 可移动点
|
|
54
54
|
*/
|
|
55
55
|
editableStatus() {
|
|
56
|
-
this.status =
|
|
56
|
+
this.status = l.EDITABLE, this.viewer.canvas.style.cursor = "pointer";
|
|
57
57
|
}
|
|
58
58
|
deletableStatus() {
|
|
59
|
-
this.status =
|
|
59
|
+
this.status = l.DELETABLE, this.viewer.canvas.style.cursor = "grabbing";
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* 停止操作
|
|
63
63
|
*/
|
|
64
64
|
stopStatus() {
|
|
65
|
-
this.status =
|
|
65
|
+
this.status = l.STOPED, this.viewer.canvas.style.cursor = "default";
|
|
66
66
|
}
|
|
67
67
|
//----------------------------------------
|
|
68
68
|
editDragUnable() {
|
|
@@ -76,16 +76,16 @@ class G {
|
|
|
76
76
|
}
|
|
77
77
|
//------------------------
|
|
78
78
|
delUnable() {
|
|
79
|
-
this.delStatus =
|
|
79
|
+
this.delStatus = A.DEL_UNABLED, this.viewer.canvas.style.cursor = "pointer";
|
|
80
80
|
}
|
|
81
81
|
delEnable() {
|
|
82
|
-
this.delStatus =
|
|
82
|
+
this.delStatus = A.DEL_ENABLED, this.viewer.canvas.style.cursor = "grabbing";
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
const
|
|
86
|
-
class
|
|
85
|
+
const G = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAQAElEQVR4AexdfYwkR3V/r3dnb884wUd03O1HTrZj4p09/CFMSBwpkqX8Ayjkj6ALQY6ixHIc8REJRUoiJUK+80eI7QQH28IOR+xIxOGwyCVRIHEE2JgD6cAfCPt2d9b4ZMt3O7uAfUYceG9ndrp4r6d1N7eeme7prq7q6np7VdvdVa/e+73f699M983OTADyIwwIAwMZEIEMpEYmhAEAEYicBcLAEAZEIEPIkSlhQAQi54AwMISBAgUyJKpMCQOOMCACcaRQAtMOAyIQO7xLVEcYEIE4UiiBaYcBEYgd3iWqIwy4KRBHyBWY7jMgAnG/hpJBgQyIQAokV1y7z4AIxP0aSgYFMiACKZBcce0+AyKQLTWUQ2GglwERSC8bsi8MbGFABLKFEDkUBnoZEIH0siH7wsAWBkQgWwiRQ2GglwERSC8bxe6LdwcZEIE4WDSBbI4BEYgBrmfV7PbZjcuvnNqY+73pdv2vplv1g1Ot+uO0fZL6IvWXqZ+ivhF33ucxnnsytj3Ia9kH+2KfBqB7H0IEUsApsOvM2y6d2Zj//Zl2/W464b8btn/h9RCD7yHif4CCOyjkjQhwHQC8k3qd+i9T30F9Iu68z2M8987Y9kZeyz7YF/tk3xyDY3FMWitNMwMiEE2E7m7t/bXpjfqdU636c2PB+HGF6gtKwccA4Goo7udqjsGxOCbHZgy7CUtxIf3yLALJUe9da1e+aaY198dTG/UvBxB+BxD+kh7t357DZcal3WVRbMLAWBgTY2OM3Vn5nYUBEUgG1natX34J3Q/cMvaW9jEF+BAivDeDm0KXMCbGxhgZK2MuNGBFnYtARijsbjW/d6o1/49jY8EzdD/wcVp6M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9at3aPMvxGuDXykWGp4SWVCScCMVzKZm2Jv4znqQxhn4rXZlgqS7IyIALJylyOdRiqkW/Ys6zJAVGWxgyIQGIiTG5WJhtfQoDPpY3Jtrwmrb3Y6WNABKKPy5E8BeEYP4uk+XLQM7HtSP7FWA8DIhA9PI7s5cTkseMKVeK7D9mGbUcOUNkFZhMTgZjl+7xoq7XGJ0Cp75032HtAc5FN75jsG2VABGKU7n7BkF8b6TdBY8PmaFpa4QyIQAqneHiA5ral/yKLz1Pf2j4fz20dl2ODDIhADJI9MFQY8g17p2e+A92xniHZtcGACMQG61tiNieXlxGBRRLN8D6PRQfyyxwDfSKJQPqQYmNopbbEf4KyQLEX4n3alWabARGI7Qr0xMcg2M+9Z0h2LTMQWI4v4XsYWBlf+CL3niHZtcyACMRyASR8uRkQgZS7PoLOMgO6BGI5DQkvDBTDgAikGF7Fa0UYEIFUpJCSRjEMiECK4VW8VoQBEUhFCilpFMOAAwIpJnHxKgykYUAEkoYlsfGWARGIt6WXxNMwIAJJw5LYeMuACMTb0kviaRjwWyBpGBIbrxkQgXhdfkk+iQERSBJDMu81AyIQr8svyScxIAJJYkjmvWZABFJQ+cVtNRj4OQAAAP//gm46zwAAAAZJREFUAwB1f5TcL2bFTAAAAABJRU5ErkJggg==";
|
|
86
|
+
class w extends k {
|
|
87
87
|
constructor(e) {
|
|
88
|
-
super(e), this.mainData = [], this.dataSource = new
|
|
88
|
+
super(e), this.mainData = [], this.dataSource = new b("drawerDataSource"), this.currentDragPoint = null, this.currentIndex = -1, this.delConfirmFun = this.delCallback, this.viewer.dataSources.add(this.dataSource);
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* 获取DataSource
|
|
@@ -100,9 +100,9 @@ class L extends G {
|
|
|
100
100
|
*/
|
|
101
101
|
refreshPositionsData() {
|
|
102
102
|
return this.mainData = [], this.dataSource.entities.values.forEach((e) => {
|
|
103
|
-
var
|
|
104
|
-
const
|
|
105
|
-
(
|
|
103
|
+
var i;
|
|
104
|
+
const t = new r();
|
|
105
|
+
(i = e.position) == null || i.getValue(I.now(), t), this.mainData.push(t);
|
|
106
106
|
}), this.mainData;
|
|
107
107
|
}
|
|
108
108
|
clearAllData() {
|
|
@@ -110,40 +110,31 @@ class L extends G {
|
|
|
110
110
|
}
|
|
111
111
|
getEntityIndex() {
|
|
112
112
|
var e;
|
|
113
|
-
for (let
|
|
114
|
-
if (this.dataSource.entities.values[
|
|
115
|
-
this.currentIndex =
|
|
113
|
+
for (let t = 0, i = this.dataSource.entities.values.length; t < i; t++)
|
|
114
|
+
if (this.dataSource.entities.values[t].id == ((e = this.currentDragPoint) == null ? void 0 : e.id)) {
|
|
115
|
+
this.currentIndex = t;
|
|
116
116
|
break;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
editMoveFun(e, i) {
|
|
120
|
-
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
121
|
-
const t = this.viewer.scene.pick(e.endPosition);
|
|
122
|
-
if (l(t) && l(t.id) && this.dataSource.entities.contains(d(t.id))) {
|
|
123
|
-
let a = d(t.id);
|
|
124
|
-
this.currentDragPoint = a, this.editDragEnable();
|
|
125
|
-
}
|
|
126
|
-
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new E(i), this.mainData[this.currentIndex] = i) : this.editDragUnable();
|
|
127
|
-
}
|
|
128
119
|
deleteMoveFun(e) {
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
|
|
120
|
+
if (A.DEL_UNABLED == super.getDelStatus()) {
|
|
121
|
+
const t = this.viewer.scene.pick(e.endPosition);
|
|
122
|
+
h(t) && h(t.id) && this.dataSource.entities.contains(d(t.id)) && this.delEnable();
|
|
132
123
|
} else
|
|
133
124
|
this.delUnable();
|
|
134
125
|
}
|
|
135
126
|
addPoint(e) {
|
|
136
|
-
let
|
|
137
|
-
return this.point ?
|
|
127
|
+
let t = null;
|
|
128
|
+
return this.point ? t = this.point : t = {
|
|
138
129
|
pixelSize: 6,
|
|
139
130
|
color: u.TRANSPARENT,
|
|
140
131
|
outlineColor: u.YELLOW,
|
|
141
132
|
outlineWidth: 2,
|
|
142
|
-
heightReference:
|
|
133
|
+
heightReference: m.CLAMP_TO_GROUND
|
|
143
134
|
//贴地
|
|
144
135
|
}, this.dataSource.entities.add({
|
|
145
136
|
position: e,
|
|
146
|
-
point:
|
|
137
|
+
point: t,
|
|
147
138
|
properties: {
|
|
148
139
|
entityType: "POINT"
|
|
149
140
|
},
|
|
@@ -152,84 +143,81 @@ class L extends G {
|
|
|
152
143
|
}
|
|
153
144
|
//在删除状态下,删除节点
|
|
154
145
|
deletePoint(e) {
|
|
155
|
-
this.
|
|
156
|
-
|
|
146
|
+
this.delConfirmFun && this.delConfirmFun().then((t) => {
|
|
147
|
+
t && (this.dataSource.entities.remove(e), this.refreshPositionsData(), this.delCallbackFun && this.delCallbackFun());
|
|
157
148
|
});
|
|
158
149
|
}
|
|
159
150
|
delCallback() {
|
|
160
151
|
return new Promise((e) => {
|
|
161
|
-
const
|
|
162
|
-
e(!!
|
|
152
|
+
const t = confirm("确定删除吗?");
|
|
153
|
+
e(!!t);
|
|
163
154
|
});
|
|
164
155
|
}
|
|
165
156
|
}
|
|
166
|
-
class
|
|
167
|
-
constructor(e,
|
|
168
|
-
super(e), this.handler = null, this.pointCollection = new
|
|
169
|
-
var
|
|
170
|
-
(
|
|
171
|
-
if (
|
|
157
|
+
class O extends w {
|
|
158
|
+
constructor(e, t = null) {
|
|
159
|
+
super(e), this.handler = null, this.pointCollection = new F(), this.addPointFun = this.addBillboardCallback, this.point_L_ClickEvent = () => {
|
|
160
|
+
var i;
|
|
161
|
+
(i = this.handler) == null || i.setInputAction((a) => {
|
|
162
|
+
if (l.DRAWABLE == super.getStatus()) {
|
|
172
163
|
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
173
|
-
if (
|
|
174
|
-
let
|
|
175
|
-
this.mainData.push(n), this.pointCollection.add(
|
|
164
|
+
if (h(n)) {
|
|
165
|
+
let L = this.addPointFun(n);
|
|
166
|
+
this.mainData.push(n), this.pointCollection.add(L), this.afterAddPointFun && this.afterAddPointFun(n);
|
|
176
167
|
}
|
|
177
|
-
} else if (
|
|
168
|
+
} else if (l.DELETABLE == super.getStatus()) {
|
|
178
169
|
const s = this.viewer.scene.pick(a.position);
|
|
179
|
-
if (
|
|
170
|
+
if (h(s) && h(s.id)) {
|
|
180
171
|
const n = d(s.id);
|
|
181
|
-
this.pointCollection.contains(n) &&
|
|
172
|
+
this.pointCollection.contains(n) && A.DEL_ENABLED == super.getDelStatus() && this.deleteBillboard(n);
|
|
182
173
|
}
|
|
183
174
|
}
|
|
184
175
|
}, c.LEFT_CLICK);
|
|
185
176
|
}, this.point_L_DownEvent = () => {
|
|
186
|
-
var
|
|
187
|
-
(
|
|
188
|
-
|
|
177
|
+
var i;
|
|
178
|
+
(i = this.handler) == null || i.setInputAction(() => {
|
|
179
|
+
l.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
189
180
|
}, c.LEFT_DOWN);
|
|
190
181
|
}, this.point_L_UpEvent = () => {
|
|
191
|
-
var
|
|
192
|
-
(
|
|
193
|
-
|
|
194
|
-
const s = this.viewer.scene.pickPosition(a.endPosition);
|
|
195
|
-
l(s) && this.editCallbackFun && this.editCallbackFun(s), this.editDragUnable(), this.currentDragPoint = null, this.viewer.scene.screenSpaceCameraController.enableRotate = !0;
|
|
196
|
-
}
|
|
182
|
+
var i;
|
|
183
|
+
(i = this.handler) == null || i.setInputAction(() => {
|
|
184
|
+
o.DRAGING == super.getEditStatus() && (this.editDragUnable(), this.currentDragPoint = null, this.viewer.scene.screenSpaceCameraController.enableRotate = !0);
|
|
197
185
|
}, c.LEFT_UP);
|
|
198
186
|
}, this.point_moveEvent = () => {
|
|
199
|
-
var
|
|
200
|
-
(
|
|
201
|
-
if (
|
|
187
|
+
var i;
|
|
188
|
+
(i = this.handler) == null || i.setInputAction((a) => {
|
|
189
|
+
if (l.EDITABLE == super.getStatus())
|
|
202
190
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
203
191
|
const s = this.viewer.scene.pick(a.endPosition);
|
|
204
|
-
if (
|
|
192
|
+
if (h(s) && h(s.id) && this.pointCollection.contains(d(s.id))) {
|
|
205
193
|
let n = d(s.id);
|
|
206
194
|
this.currentDragPoint = n, this.editDragEnable();
|
|
207
195
|
}
|
|
208
196
|
} else if (o.DRAGING == super.getEditStatus()) {
|
|
209
197
|
const s = this.viewer.scene.pickPosition(a.endPosition);
|
|
210
|
-
|
|
198
|
+
h(s) && this.currentDragPoint && (this.currentDragPoint.position = new E(s), this.editPointFun && this.editPointFun(s, this.currentDragPoint));
|
|
211
199
|
} else
|
|
212
200
|
this.editDragUnable();
|
|
213
|
-
else if (
|
|
214
|
-
if (
|
|
201
|
+
else if (l.DELETABLE == super.getStatus())
|
|
202
|
+
if (A.DEL_UNABLED == super.getDelStatus()) {
|
|
215
203
|
const s = this.viewer.scene.pick(a.endPosition);
|
|
216
|
-
|
|
204
|
+
h(s) && h(s.id) && this.pointCollection.contains(d(s.id)) && this.delEnable();
|
|
217
205
|
} else
|
|
218
206
|
this.delUnable();
|
|
219
207
|
}, c.MOUSE_MOVE);
|
|
220
|
-
},
|
|
208
|
+
}, t && (this.addPointFun = t.addPointFun ? t.addPointFun : this.addBillboardCallback, this.delConfirmFun = t.delConfirmFun ? t.delConfirmFun : this.delCallback, t.afterAddPointFun && (this.afterAddPointFun = t.afterAddPointFun), t.editPointFun && (this.editPointFun = t.editPointFun));
|
|
221
209
|
}
|
|
222
210
|
start() {
|
|
223
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
211
|
+
super.drawableStatus(), this.handler || (this.handler = new y(this.viewer.scene.canvas)), this.point_L_ClickEvent(), this.point_L_DownEvent(), this.point_L_UpEvent(), this.point_moveEvent();
|
|
224
212
|
}
|
|
225
|
-
|
|
213
|
+
getEntities() {
|
|
226
214
|
return this.pointCollection;
|
|
227
215
|
}
|
|
228
216
|
clearAll() {
|
|
229
217
|
var e;
|
|
230
|
-
this.clearAllData(), this.
|
|
231
|
-
for (let
|
|
232
|
-
const a = this.pointCollection.values[
|
|
218
|
+
this.clearAllData(), this.addPointFun = this.addBillboardCallback;
|
|
219
|
+
for (let t = 0, i = this.pointCollection.values.length; t < i; t++) {
|
|
220
|
+
const a = this.pointCollection.values[t];
|
|
233
221
|
this.viewer.entities.removeById(a.id);
|
|
234
222
|
}
|
|
235
223
|
(e = this.handler) == null || e.destroy();
|
|
@@ -239,69 +227,74 @@ class T extends L {
|
|
|
239
227
|
// 设置经纬度位置 (经度, 纬度, 海拔高度)
|
|
240
228
|
position: e,
|
|
241
229
|
billboard: {
|
|
242
|
-
image:
|
|
230
|
+
image: G,
|
|
243
231
|
// 设置图片显示的宽度和高度 (像素)
|
|
244
232
|
width: 40,
|
|
245
233
|
height: 40,
|
|
246
234
|
// 可选项:缩放倍数
|
|
247
235
|
scale: 1,
|
|
248
|
-
verticalOrigin:
|
|
249
|
-
heightReference:
|
|
236
|
+
verticalOrigin: B.BOTTOM,
|
|
237
|
+
heightReference: m.CLAMP_TO_GROUND
|
|
250
238
|
//贴地
|
|
251
239
|
},
|
|
252
240
|
show: !0
|
|
253
241
|
});
|
|
254
242
|
}
|
|
255
243
|
deleteBillboard(e) {
|
|
256
|
-
this.
|
|
257
|
-
|
|
244
|
+
this.delConfirmFun ? this.delConfirmFun().then((t) => {
|
|
245
|
+
t && (this.viewer.entities.remove(e), this.refreshPositionsData());
|
|
258
246
|
}) : confirm("确定要删除吗?") && (this.viewer.entities.remove(e), this.refreshPositionsData());
|
|
259
247
|
}
|
|
260
248
|
}
|
|
261
|
-
const
|
|
249
|
+
const g = {
|
|
262
250
|
LINE: Symbol("LINE"),
|
|
263
251
|
//画线模式
|
|
264
252
|
POLYGON: Symbol("POLYGON")
|
|
265
253
|
//画面模式
|
|
266
254
|
};
|
|
267
|
-
class
|
|
268
|
-
constructor(e,
|
|
269
|
-
super(e), this.handler = null, this.mainLineEntity = null, this.mainPolygonEntity = null, this.dashLineEntity = null, this.dashEndData =
|
|
270
|
-
var
|
|
271
|
-
(
|
|
272
|
-
|
|
255
|
+
class T extends w {
|
|
256
|
+
constructor(e, t = null) {
|
|
257
|
+
super(e), this.handler = null, this.mainLineEntity = null, this.mainPolygonEntity = null, this.dashLineEntity = null, this.dashEndData = null, this.drawerMode = g.LINE, this.r_ClickEvent = () => {
|
|
258
|
+
var i;
|
|
259
|
+
(i = this.handler) == null || i.setInputAction(() => {
|
|
260
|
+
l.DRAWABLE == super.getStatus() && (this.dashLineEntity && this.viewer.entities.removeById(this.dashLineEntity.id), this.dashEndData = null, this.stopStatus(), this.overCallbackFun && this.overCallbackFun());
|
|
261
|
+
}, c.RIGHT_CLICK);
|
|
262
|
+
}, this.l_ClickEvent = () => {
|
|
263
|
+
var i;
|
|
264
|
+
(i = this.handler) == null || i.setInputAction((a) => {
|
|
265
|
+
if (l.DRAWABLE == super.getStatus()) {
|
|
273
266
|
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
274
|
-
|
|
275
|
-
} else if (
|
|
267
|
+
h(n) && (this.addPoint(n), this.afterAddPointFun && this.afterAddPointFun(n), this.mainData.push(n), this.mainData.length > 0 && (this.mainLineEntity || this.createMainLine(), this.dashLineEntity || this.createDashline(), this.mainData.length > 1 && this.drawerMode === g.POLYGON && !this.mainPolygonEntity && this.createMainPolygon()));
|
|
268
|
+
} else if (l.DELETABLE == super.getStatus()) {
|
|
276
269
|
const s = this.viewer.scene.pick(a.position);
|
|
277
|
-
if (
|
|
270
|
+
if (h(s) && h(s.id)) {
|
|
278
271
|
const n = d(s.id);
|
|
279
|
-
this.dataSource.entities.contains(n) &&
|
|
272
|
+
this.dataSource.entities.contains(n) && A.DEL_ENABLED == super.getDelStatus() && this.deletePoint(n);
|
|
280
273
|
}
|
|
281
274
|
}
|
|
282
275
|
}, c.LEFT_CLICK);
|
|
283
|
-
}, this.
|
|
284
|
-
var
|
|
285
|
-
(
|
|
286
|
-
|
|
276
|
+
}, this.l_DownEvent = () => {
|
|
277
|
+
var i;
|
|
278
|
+
(i = this.handler) == null || i.setInputAction(() => {
|
|
279
|
+
l.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.getEntityIndex(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
287
280
|
}, c.LEFT_DOWN);
|
|
288
|
-
}, this.
|
|
289
|
-
var
|
|
290
|
-
(
|
|
281
|
+
}, this.l_UpEvent = () => {
|
|
282
|
+
var i;
|
|
283
|
+
(i = this.handler) == null || i.setInputAction(() => {
|
|
291
284
|
o.DRAGING == super.getEditStatus() && (this.editDragUnable(), this.currentDragPoint = null, this.viewer.scene.screenSpaceCameraController.enableRotate = !0);
|
|
292
285
|
}, c.LEFT_UP);
|
|
293
|
-
}, this.
|
|
294
|
-
var
|
|
295
|
-
(
|
|
286
|
+
}, this.moveEvent = () => {
|
|
287
|
+
var i;
|
|
288
|
+
(i = this.handler) == null || i.setInputAction((a) => {
|
|
296
289
|
const s = this.viewer.camera.getPickRay(a.endPosition);
|
|
297
290
|
if (s) {
|
|
298
291
|
const n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
299
|
-
|
|
292
|
+
h(n) && (l.DRAWABLE == super.getStatus() ? (this.dashEndData = n, this.movingCallbackFun && this.movingCallbackFun(n)) : l.EDITABLE == super.getStatus() ? (this.dashLineEntity.show = !1, this.editMoveFun(a, n)) : l.DELETABLE == super.getStatus() && (this.dashLineEntity.show = !1, this.deleteMoveFun(a)));
|
|
300
293
|
}
|
|
301
294
|
}, c.MOUSE_MOVE);
|
|
302
295
|
}, this.createDashline = () => {
|
|
303
|
-
let
|
|
304
|
-
this.deshline ?
|
|
296
|
+
let i;
|
|
297
|
+
this.deshline ? i = this.deshline : i = {
|
|
305
298
|
positions: [
|
|
306
299
|
new r(),
|
|
307
300
|
new r()
|
|
@@ -313,29 +306,41 @@ class O extends L {
|
|
|
313
306
|
}),
|
|
314
307
|
show: !0,
|
|
315
308
|
clampToGround: !0
|
|
316
|
-
},
|
|
309
|
+
}, i.positions = new D(() => {
|
|
317
310
|
let a = this.mainData.length, s = this.mainData[a - 1];
|
|
318
|
-
return s || (s = this.mainData[a - 2]), this.dashEndData
|
|
311
|
+
return s || (s = this.mainData[a - 2]), this.dashEndData ? [s, this.dashEndData] : [s, new r()];
|
|
319
312
|
}, !1), this.dashLineEntity = this.viewer.entities.add({
|
|
320
|
-
polyline:
|
|
313
|
+
polyline: i,
|
|
321
314
|
properties: {
|
|
322
315
|
entityType: "DASHLINE"
|
|
323
316
|
}
|
|
324
317
|
});
|
|
325
|
-
},
|
|
318
|
+
}, t && (t.drawerMode && (this.drawerMode = t.drawerMode), this.point = t.point, this.polyline = t.polyline, this.deshline = t.deshline, this.polygon = t.polygon, t.afterAddPointFun && (this.afterAddPointFun = t.afterAddPointFun), t.movingCallbackFun && (this.movingCallbackFun = t.movingCallbackFun), t.editCallbackFun && (this.editCallbackFun = t.editCallbackFun), t.delCallbackFun && (this.delCallbackFun = t.delCallbackFun), t.overCallbackFun && (this.overCallbackFun = t.overCallbackFun), this.delConfirmFun = t.delConfirmFun ? t.delConfirmFun : this.delCallback);
|
|
326
319
|
}
|
|
327
320
|
start() {
|
|
328
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
321
|
+
super.drawableStatus(), this.handler || (this.handler = new y(this.viewer.scene.canvas)), this.r_ClickEvent(), this.l_ClickEvent(), this.l_DownEvent(), this.l_UpEvent(), this.moveEvent();
|
|
329
322
|
}
|
|
330
323
|
getEntity() {
|
|
331
|
-
if (this.drawerMode ===
|
|
324
|
+
if (this.drawerMode === g.LINE)
|
|
332
325
|
return this.mainLineEntity;
|
|
333
|
-
if (this.drawerMode ===
|
|
326
|
+
if (this.drawerMode === g.POLYGON)
|
|
334
327
|
return this.mainPolygonEntity;
|
|
335
328
|
}
|
|
329
|
+
getPositions() {
|
|
330
|
+
return this.refreshPositionsData();
|
|
331
|
+
}
|
|
336
332
|
clearAll() {
|
|
337
333
|
this.clearAllData(), this.handler = null, this.mainLineEntity && this.viewer.entities.removeById(this.mainLineEntity.id), this.mainPolygonEntity && this.viewer.entities.removeById(this.mainPolygonEntity.id), this.dashLineEntity && this.viewer.entities.removeById(this.dashLineEntity.id);
|
|
338
334
|
}
|
|
335
|
+
editMoveFun(e, t) {
|
|
336
|
+
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
337
|
+
const i = this.viewer.scene.pick(e.endPosition);
|
|
338
|
+
if (h(i) && h(i.id) && this.dataSource.entities.contains(d(i.id))) {
|
|
339
|
+
let a = d(i.id);
|
|
340
|
+
this.currentDragPoint = a, this.editDragEnable();
|
|
341
|
+
}
|
|
342
|
+
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new E(t), this.mainData[this.currentIndex] = t, this.editCallbackFun && this.editCallbackFun(t, this.currentIndex)) : this.editDragUnable();
|
|
343
|
+
}
|
|
339
344
|
//创建主线数据
|
|
340
345
|
createMainLine() {
|
|
341
346
|
let e;
|
|
@@ -348,7 +353,7 @@ class O extends L {
|
|
|
348
353
|
// 是否显示
|
|
349
354
|
show: !0,
|
|
350
355
|
clampToGround: !0
|
|
351
|
-
}, e.positions = new
|
|
356
|
+
}, e.positions = new D(() => this.mainData, !1), this.mainLineEntity = this.viewer.entities.add({
|
|
352
357
|
polyline: e,
|
|
353
358
|
properties: {
|
|
354
359
|
entityType: "LINE"
|
|
@@ -362,7 +367,10 @@ class O extends L {
|
|
|
362
367
|
hierarchy: [new r(), new r(), new r()],
|
|
363
368
|
material: u.RED.withAlpha(0.4),
|
|
364
369
|
outline: !1
|
|
365
|
-
}, e.hierarchy = new
|
|
370
|
+
}, e.hierarchy = new D(() => {
|
|
371
|
+
let t = this.mainData;
|
|
372
|
+
return this.dashEndData && (t = [...this.mainData, this.dashEndData]), new C(t);
|
|
373
|
+
}, !1), this.mainPolygonEntity = this.viewer.entities.add({
|
|
366
374
|
polygon: e,
|
|
367
375
|
properties: {
|
|
368
376
|
entityType: "POLYGON"
|
|
@@ -370,60 +378,62 @@ class O extends L {
|
|
|
370
378
|
});
|
|
371
379
|
}
|
|
372
380
|
}
|
|
373
|
-
class x extends
|
|
374
|
-
|
|
375
|
-
constructor(e, i = null) {
|
|
381
|
+
class x extends w {
|
|
382
|
+
constructor(e, t = null) {
|
|
376
383
|
super(e), this.handler = null, this.firstPoint = null, this.endPoint = null, this.lineEntity = null, this.polygonEntity = null, this.rect_L_ClickEvent = () => {
|
|
377
|
-
var
|
|
378
|
-
(
|
|
379
|
-
if (
|
|
384
|
+
var i;
|
|
385
|
+
(i = this.handler) == null || i.setInputAction((a) => {
|
|
386
|
+
if (l.DRAWABLE == super.getStatus()) {
|
|
380
387
|
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
381
|
-
|
|
388
|
+
h(n) && (this.mainData.length === 0 ? (this.addPoint(n), this.firstPoint = n, this.mainData.push(n), this.createLine(), this.createPolygon()) : (this.addPoint(n), this.endPoint = n, this.stopStatus(), this.initMainData(), this.rectOverFun && this.rectOverFun(this.mainData)));
|
|
382
389
|
}
|
|
383
390
|
}, c.LEFT_CLICK);
|
|
384
391
|
}, this.rect_L_DownEvent = () => {
|
|
385
|
-
var
|
|
386
|
-
(
|
|
387
|
-
|
|
392
|
+
var i;
|
|
393
|
+
(i = this.handler) == null || i.setInputAction(() => {
|
|
394
|
+
l.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.getEntityIndex(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
388
395
|
}, c.LEFT_DOWN);
|
|
389
396
|
}, this.rect_L_UpEvent = () => {
|
|
390
|
-
var
|
|
391
|
-
(
|
|
397
|
+
var i;
|
|
398
|
+
(i = this.handler) == null || i.setInputAction(() => {
|
|
392
399
|
o.DRAGING == super.getEditStatus() && (this.editDragUnable(), this.currentDragPoint = null, this.viewer.scene.screenSpaceCameraController.enableRotate = !0);
|
|
393
400
|
}, c.LEFT_UP);
|
|
394
401
|
}, this.rect_moveEvent = () => {
|
|
395
|
-
var
|
|
396
|
-
(
|
|
402
|
+
var i;
|
|
403
|
+
(i = this.handler) == null || i.setInputAction((a) => {
|
|
397
404
|
const s = this.viewer.camera.getPickRay(a.endPosition);
|
|
398
405
|
if (s) {
|
|
399
406
|
const n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
400
|
-
|
|
407
|
+
h(n) && (l.DRAWABLE == super.getStatus() ? this.firstPoint && (this.endPoint = n, this.initMainData(), this.rectMovingFun && this.rectMovingFun(this.mainData)) : l.EDITABLE == super.getStatus() && (this.rectMove(a, n), this.rectEditFun && this.rectEditFun(this.mainData)));
|
|
401
408
|
}
|
|
402
409
|
}, c.MOUSE_MOVE);
|
|
403
|
-
},
|
|
410
|
+
}, t && (this.point = t.point, this.polyline = t.polyline, this.polygon = t.polygon, t.rectOverFun && (this.rectOverFun = t.rectOverFun), t.rectMovingFun && (this.rectMovingFun = t.rectMovingFun), t.rectEditFun && (this.rectEditFun = t.rectEditFun));
|
|
404
411
|
}
|
|
405
412
|
start() {
|
|
406
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
413
|
+
super.drawableStatus(), this.handler || (this.handler = new y(this.viewer.scene.canvas)), this.rect_L_ClickEvent(), this.rect_L_DownEvent(), this.rect_L_UpEvent(), this.rect_moveEvent();
|
|
407
414
|
}
|
|
408
415
|
getEntity() {
|
|
409
416
|
this.polygonEntity;
|
|
410
417
|
}
|
|
418
|
+
getPositions() {
|
|
419
|
+
return this.refreshPositionsData();
|
|
420
|
+
}
|
|
411
421
|
clearAll() {
|
|
412
|
-
this.clearAllData(), this.firstPoint = new r(), this.endPoint = new r(), this.handler && (this.handler = null), this.polygonEntity && this.viewer.entities.removeById(this.polygonEntity.id), this.lineEntity && this.viewer.entities.removeById(this.lineEntity.id);
|
|
422
|
+
this.clearAllData(), this.firstPoint = new r(), this.endPoint = new r(), this.mainData = [], this.handler && (this.handler = null), this.polygonEntity && this.viewer.entities.removeById(this.polygonEntity.id), this.lineEntity && this.viewer.entities.removeById(this.lineEntity.id);
|
|
413
423
|
}
|
|
414
|
-
rectMove(e,
|
|
424
|
+
rectMove(e, t) {
|
|
415
425
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
416
|
-
const
|
|
417
|
-
if (
|
|
418
|
-
let a = d(
|
|
426
|
+
const i = this.viewer.scene.pick(e.endPosition);
|
|
427
|
+
if (h(i) && h(i.id) && this.dataSource.entities.contains(d(i.id))) {
|
|
428
|
+
let a = d(i.id);
|
|
419
429
|
this.currentDragPoint = a, this.editDragEnable();
|
|
420
430
|
}
|
|
421
|
-
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new E(
|
|
431
|
+
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new E(t), this.currentIndex === 0 ? this.firstPoint = t : this.endPoint = t, this.initMainData()) : this.editDragUnable();
|
|
422
432
|
}
|
|
423
433
|
initMainData() {
|
|
424
434
|
if (this.firstPoint && this.endPoint) {
|
|
425
|
-
const e =
|
|
426
|
-
this.mainData[0] = this.firstPoint, this.mainData[1] =
|
|
435
|
+
const e = v.fromCartesian(this.firstPoint), t = e.longitude, i = e.latitude, a = v.fromCartesian(this.endPoint), s = a.longitude, n = a.latitude, L = r.fromRadians(t, n), S = r.fromRadians(s, i);
|
|
436
|
+
this.mainData[0] = this.firstPoint, this.mainData[1] = L, this.mainData[2] = this.endPoint, this.mainData[3] = S;
|
|
427
437
|
}
|
|
428
438
|
}
|
|
429
439
|
//创建主线数据
|
|
@@ -438,7 +448,7 @@ class x extends L {
|
|
|
438
448
|
// 是否显示
|
|
439
449
|
show: !0,
|
|
440
450
|
clampToGround: !0
|
|
441
|
-
}, e.positions = new
|
|
451
|
+
}, e.positions = new D(() => [...this.mainData, this.mainData[0]], !1), this.lineEntity = this.viewer.entities.add({
|
|
442
452
|
polyline: e,
|
|
443
453
|
properties: {
|
|
444
454
|
entityType: "LINE"
|
|
@@ -452,7 +462,7 @@ class x extends L {
|
|
|
452
462
|
hierarchy: [new r(), new r(), new r()],
|
|
453
463
|
material: u.RED.withAlpha(0.4),
|
|
454
464
|
outline: !1
|
|
455
|
-
}, e.hierarchy = new
|
|
465
|
+
}, e.hierarchy = new D(() => new C(this.mainData), !1), this.polygonEntity = this.viewer.entities.add({
|
|
456
466
|
polygon: e,
|
|
457
467
|
properties: {
|
|
458
468
|
entityType: "POLYGON"
|
|
@@ -460,40 +470,39 @@ class x extends L {
|
|
|
460
470
|
});
|
|
461
471
|
}
|
|
462
472
|
}
|
|
463
|
-
class Q extends
|
|
464
|
-
|
|
465
|
-
constructor(e, i = null) {
|
|
473
|
+
class Q extends w {
|
|
474
|
+
constructor(e, t = null) {
|
|
466
475
|
super(e), this.handler = null, this.firstPoint = new r(), this.endPoint = new r(), this.distance = 0, this.angle = 0, this.endPointEntity = null, this.ellipseEntity = null, this.circle_L_ClickEvent = () => {
|
|
467
|
-
var
|
|
468
|
-
(
|
|
469
|
-
if (
|
|
476
|
+
var i;
|
|
477
|
+
(i = this.handler) == null || i.setInputAction((a) => {
|
|
478
|
+
if (l.DRAWABLE == super.getStatus()) {
|
|
470
479
|
let s = this.viewer.camera.getPickRay(a.position), n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
471
|
-
|
|
480
|
+
h(n) && (this.mainData.length === 0 ? (this.addPoint(n), this.mainData.push(n), this.firstPoint = n, this.createCircle()) : (this.endPoint = n, this.mainData.push(n), this.endPointEntity = this.addPoint(n), this.setAngle(), this.stopStatus(), this.circleOverFun && this.circleOverFun(this.firstPoint, this.endPoint)));
|
|
472
481
|
}
|
|
473
482
|
}, c.LEFT_CLICK);
|
|
474
483
|
}, this.circle_L_DownEvent = () => {
|
|
475
|
-
var
|
|
476
|
-
(
|
|
477
|
-
|
|
484
|
+
var i;
|
|
485
|
+
(i = this.handler) == null || i.setInputAction(() => {
|
|
486
|
+
l.EDITABLE == super.getStatus() && o.DRAG_ENABLED == super.getEditStatus() && (super.editDraging(), this.getEntityIndex(), this.viewer.scene.screenSpaceCameraController.enableRotate = !1);
|
|
478
487
|
}, c.LEFT_DOWN);
|
|
479
488
|
}, this.circle_L_UpEvent = () => {
|
|
480
|
-
var
|
|
481
|
-
(
|
|
482
|
-
o.DRAGING == super.getEditStatus() && (this.editDragUnable(), this.currentDragPoint = null, this.viewer.scene.screenSpaceCameraController.enableRotate = !0);
|
|
489
|
+
var i;
|
|
490
|
+
(i = this.handler) == null || i.setInputAction(() => {
|
|
491
|
+
o.DRAGING == super.getEditStatus() && (this.editDragUnable(), this.currentDragPoint = null, this.setAngle(), this.viewer.scene.screenSpaceCameraController.enableRotate = !0);
|
|
483
492
|
}, c.LEFT_UP);
|
|
484
493
|
}, this.circle_moveEvent = () => {
|
|
485
|
-
var
|
|
486
|
-
(
|
|
494
|
+
var i;
|
|
495
|
+
(i = this.handler) == null || i.setInputAction((a) => {
|
|
487
496
|
const s = this.viewer.camera.getPickRay(a.endPosition);
|
|
488
497
|
if (s) {
|
|
489
498
|
const n = this.viewer.scene.globe.pick(s, this.viewer.scene);
|
|
490
|
-
|
|
499
|
+
h(n) && (l.DRAWABLE == super.getStatus() ? this.mainData.length > 0 && (this.endPoint = n, this.countDistance(), this.circleMovingFun && this.circleMovingFun(this.firstPoint, n)) : l.EDITABLE == super.getStatus() && (this.circleMove(a, n), this.circleEditFun && this.circleEditFun(this.firstPoint, this.endPoint)));
|
|
491
500
|
}
|
|
492
501
|
}, c.MOUSE_MOVE);
|
|
493
|
-
},
|
|
502
|
+
}, t && (this.point = t.point, this.ellipse = t.ellipse, t.circleOverFun && (this.circleOverFun = t.circleOverFun), t.circleMovingFun && (this.circleMovingFun = t.circleMovingFun), t.circleEditFun && (this.circleEditFun = t.circleEditFun));
|
|
494
503
|
}
|
|
495
504
|
start() {
|
|
496
|
-
super.drawableStatus(), this.handler || (this.handler = new
|
|
505
|
+
super.drawableStatus(), this.handler || (this.handler = new y(this.viewer.scene.canvas)), this.circle_L_ClickEvent(), this.circle_L_DownEvent(), this.circle_L_UpEvent(), this.circle_moveEvent();
|
|
497
506
|
}
|
|
498
507
|
getEntity() {
|
|
499
508
|
return this.ellipse;
|
|
@@ -501,18 +510,18 @@ class Q extends L {
|
|
|
501
510
|
clearAll() {
|
|
502
511
|
this.clearAllData(), this.firstPoint = new r(), this.endPoint = new r(), this.handler && (this.handler = null), this.ellipseEntity && this.viewer.entities.removeById(this.ellipseEntity.id);
|
|
503
512
|
}
|
|
504
|
-
|
|
505
|
-
const e =
|
|
506
|
-
this.angle = Math.atan2(
|
|
513
|
+
setAngle() {
|
|
514
|
+
const e = P.eastNorthUpToFixedFrame(this.firstPoint.clone()), t = p.inverse(e, new p()), i = p.multiplyByPoint(t, this.endPoint.clone(), new r());
|
|
515
|
+
this.angle = Math.atan2(i.x, i.y);
|
|
507
516
|
}
|
|
508
|
-
circleMove(e,
|
|
517
|
+
circleMove(e, t) {
|
|
509
518
|
if (o.DRAG_UNABLED == super.getEditStatus()) {
|
|
510
|
-
const
|
|
511
|
-
if (
|
|
512
|
-
let a = d(
|
|
519
|
+
const i = this.viewer.scene.pick(e.endPosition);
|
|
520
|
+
if (h(i) && h(i.id) && this.dataSource.entities.contains(d(i.id))) {
|
|
521
|
+
let a = d(i.id);
|
|
513
522
|
this.currentDragPoint = a, this.editDragEnable();
|
|
514
523
|
}
|
|
515
|
-
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new E(
|
|
524
|
+
} else o.DRAGING == super.getEditStatus() ? this.currentDragPoint && (this.currentDragPoint.position = new E(t), this.currentIndex === 0 ? (this.firstPoint = t, this.ellipseEntity && (this.ellipseEntity.position = new E(this.firstPoint)), this.endPointEntity && (this.updateEndPoint(), this.endPointEntity.position = new E(this.endPoint))) : (this.endPoint = t, this.countDistance())) : this.editDragUnable();
|
|
516
525
|
}
|
|
517
526
|
updateEndPoint() {
|
|
518
527
|
var e = new r(
|
|
@@ -520,13 +529,13 @@ class Q extends L {
|
|
|
520
529
|
this.distance * Math.cos(this.angle),
|
|
521
530
|
0
|
|
522
531
|
// 保持水平,如果希望保持高度则设为 localEdge.z
|
|
523
|
-
),
|
|
524
|
-
this.endPoint = r.add(this.firstPoint,
|
|
532
|
+
), t = P.eastNorthUpToFixedFrame(this.firstPoint), i = p.multiplyByPointAsVector(t, e, new r());
|
|
533
|
+
this.endPoint = r.add(this.firstPoint, i, new r());
|
|
525
534
|
}
|
|
526
535
|
countDistance() {
|
|
527
536
|
if (this.firstPoint && this.endPoint) {
|
|
528
|
-
const e =
|
|
529
|
-
this.distance =
|
|
537
|
+
const e = v.fromCartesian(this.firstPoint), t = v.fromCartesian(this.endPoint), i = new R(e, t);
|
|
538
|
+
this.distance = i.surfaceDistance;
|
|
530
539
|
}
|
|
531
540
|
}
|
|
532
541
|
//创建主面数据
|
|
@@ -546,7 +555,7 @@ class Q extends L {
|
|
|
546
555
|
outline: !0,
|
|
547
556
|
// 是否显示边框
|
|
548
557
|
outlineColor: u.RED
|
|
549
|
-
}, e.semiMinorAxis = e.semiMajorAxis = new
|
|
558
|
+
}, e.semiMinorAxis = e.semiMajorAxis = new D(() => this.distance, !1), this.ellipseEntity = this.viewer.entities.add({
|
|
550
559
|
position: new E(this.firstPoint),
|
|
551
560
|
ellipse: e,
|
|
552
561
|
properties: {
|
|
@@ -556,10 +565,10 @@ class Q extends L {
|
|
|
556
565
|
}
|
|
557
566
|
}
|
|
558
567
|
export {
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
568
|
+
T as C,
|
|
569
|
+
l as D,
|
|
570
|
+
O as P,
|
|
562
571
|
x as R,
|
|
563
572
|
Q as a,
|
|
564
|
-
|
|
573
|
+
g as b
|
|
565
574
|
};
|